Image encoding/decoding method and device, and recording medium storing bitstream

ABSTRACT

Provided are an image encoding/decoding method and device. An image decoding method according to the present invention comprises the steps of: determining an intra prediction mode of a current block; and generating a prediction block of the current block by performing prediction on the basis of the intra prediction mode of the current block. An intra prediction mode for a luminance block of the current block is derived by means of a most probable mode (MPM) list comprises a plurality of MPM candidates. The MPM list can be constructed independently from as to whether a plurality of reference sample lines are used and whether a divided prediction is performed by means of a sub-block.

TECHNICAL FIELD

The present invention relates to a method and apparatus forencoding/decoding an image, and a recording medium for storingbitstream. More particularly, the present invention relates to a methodand apparatus for encoding/decoding an image using intra predictionbetween color components.

BACKGROUND ART

Recently, the demand for high resolution and quality images such as highdefinition (HD) or ultra-high definition (UHD) images has increased invarious applications. As the resolution and quality of images areimproved, the amount of data correspondingly increases. This is one ofthe causes of increase in transmission cost and storage cost whentransmitting image data through existing transmission media such aswired or wireless broadband channels or when storing image data. Inorder to solve such problems with high resolution and quality imagedata, a high efficiency image encoding/decoding technique is required.

There are various video compression techniques such as an interprediction technique of predicting the values of pixels within a currentpicture from the values of pixels within a preceding picture or asubsequent picture, an intra prediction technique of predicting thevalues of pixels within a region of a current picture from the values ofpixels within another region of the current picture, a transform andquantization technique of compressing the energy of a residual signal,and an entropy coding technique of allocating frequently occurring pixelvalues with shorter codes and less occurring pixel values with longercodes.

DISCLOSURE Technical Problem

An object of the present invention is to provide an imageencoding/decoding method and apparatus with improved encoding/decodingefficiency.

Another object of the present invention is to provide an imageencoding/decoding method and apparatus with increased entropy codingefficiency, by using intra prediction between color components.

Another object of the present invention is to provide a recording mediumfor storing a bitstream generated by an image decoding method orapparatus according to the present invention.

Technical Solution

A method of decoding an image according to an embodiment of the presentinvention includes determining an intra-prediction mode of a currentblock and generating a prediction block of the current block byperforming prediction based on the intra-prediction mode of the currentblock, wherein an intra-prediction mode for a luma block of the currentblock is derived by using an MPM list comprising a multiplicity of MPM(Most Probable Mode) candidates, and wherein the MPM list is constructedindependently of whether or not a multiplicity of reference sample linesis used and whether or not partition prediction through a sub-block isperformed.

In the image decoding method, wherein the MPM list does not comprise aPlanar mode.

In the image decoding method, wherein the MPM list comprises five MPMcandidates.

In the image decoding method, wherein an intra-prediction mode for achroma block of the current block is determined based on whether or notintra prediction between color components can be performed for thecurrent block.

In the image decoding method, wherein the whether or not intraprediction between color components can be performed for the currentblock is determined based on a coding parameter for the current block.

In the image decoding method, wherein the coding parameter for thecurrent block comprises at least one of a slice type comprising thecurrent block and information on whether or not the current block is ablock that is dual-tree partitioned.

In the image decoding method, wherein, when intra prediction betweencolor components may be performed for the current block, based oninformation on whether or not intra prediction between color componentsis applied to the current block, an intra-prediction mode for a chromablock of the current block is determined.

In the image decoding method, wherein, when CIIP (Combined Inter andIntra Prediction) is applied to the current block, an intra-predictionmode of the current block is determined as a predetermined mode.

In the image decoding method, wherein the predetermined mode is a Planarmode.

A method of encoding an image according to an embodiment of the presentinvention includes determining an intra-prediction mode of a currentblock and generating a prediction block of the current block byperforming prediction based on the intra-prediction mode of the currentblock, wherein an intra-prediction mode for a luma block of the currentblock is derived by using an MPM list comprising a multiplicity of MPM(Most Probable Mode) candidates, and wherein the MPM list is constructedindependently of whether or not a multiplicity of reference sample linesis used and whether or not partition prediction through a sub-block isperformed.

In the image encoding method, wherein the MPM list does not comprise aPlanar mode.

In the image encoding method, wherein the MPM list comprises five MPMcandidates.

In the image encoding method, wherein an intra-prediction mode for achroma block of the current block is determined based on whether or notintra prediction between color components can be performed for thecurrent block.

In the image encoding method, wherein the whether or not intraprediction between color components can be performed for the currentblock is determined based on a coding parameter for the current block.

In the image encoding method, wherein the coding parameter for thecurrent block comprises at least one of a slice type comprising thecurrent block and information on whether or not the current block is ablock that is dual-tree partitioned.

In the image encoding method, when prediction between color componentscan be performed for the current block, further comprising judgingwhether or not prediction between color components is applied to thecurrent block and encoding information on whether or not predictionbetween color components is applied to the current block.

In the image encoding method, wherein, when CIIP (Combined Inter andIntra Prediction) is applied to the current block, an intra-predictionmode of the current block is determined as a predetermined mode.

In the image encoding method, wherein the predetermined mode is a Planarmode.

In a non-transitory computer-readable recording medium for storing abitstream generated by a method of encoding an image according to anembodiment of the present invention, the method includes determining anintra-prediction mode of a current block and generating a predictionblock of the current block by performing prediction based on theintra-prediction mode of the current block, wherein an intra-predictionmode for a luma block of the current block is derived by using an MPMlist comprising a multiplicity of MPM (Most Probable Mode) candidates,and wherein the MPM list is constructed independently of whether or nota multiplicity of reference sample lines is used and whether or notpartition prediction through a sub-block is performed.

Advantageous Effects

According to the present invention, it is possible to provide an imageencoding/decoding method and apparatus with improved encoding/decodingefficiency.

According to the present invention, it is possible to provide an imageencoding/decoding method and apparatus with increased entropy codingefficiency, by using intra prediction between color components.

According to the present invention, it is possible to provide arecording medium for storing a bitstream generated by an image encodingmethod or apparatus according to the present invention.

According to the present invention, it is possible to provide arecording medium for storing a bitstream received and decoded by animage decoding apparatus according to the present invention and used torestructure an image.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram showing a configuration of an encodingapparatus according to an embodiment to which the present invention isapplied.

FIG. 2 is a block diagram showing a configuration of a decodingapparatus according to an embodiment and to which the present inventionis applied.

FIG. 3 is a view schematically showing a partition structure of an imagewhen encoding and decoding the image.

FIG. 4 is a view showing an intra-prediction process.

FIG. 5 is a diagram illustrating an embodiment of an inter-pictureprediction process.

FIG. 6 is a diagram illustrating a transform and quantization process.

FIG. 7 is a diagram illustrating reference samples capable of being usedfor intra prediction.

FIG. 8 is a view for explaining the relationship between a luma blockand a chroma block.

FIG. 9 is a view for explaining an embodiment where a current block ispartitioned into sub-blocks.

FIG. 10 is a view for explaining an embodiment where a current block ispartitioned into sub-blocks.

FIG. 11 is a view for explaining an intra-prediction mode of aneighboring block, which is used to derive an intra-prediction mode of acurrent block, according to an embodiment of the present invention.

FIG. 12 is a view illustrating an example of intra-prediction modeaccording to an embodiment of the present invention.

FIG. 13 is a view for explaining a process of deriving an MPM accordingto an embodiment of the present invention.

FIG. 14 is a view for explaining an embodiment of DC predictionaccording to the size and/or shape of a current block in accordance withan embodiment of the present invention.

FIG. 15 is a view for explaining a process of performing intraprediction between color components to an embodiment of the presentinvention.

MODE FOR INVENTION

A variety of modifications may be made to the present invention andthere are various embodiments of the present invention, examples ofwhich will now be provided with reference to drawings and described indetail. However, the present invention is not limited thereto, althoughthe exemplary embodiments can be construed as including allmodifications, equivalents, or substitutes in a technical concept and atechnical scope of the present invention. The similar reference numeralsrefer to the same or similar functions in various aspects. In thedrawings, the shapes and dimensions of elements may be exaggerated forclarity. In the following detailed description of the present invention,references are made to the accompanying drawings that show, by way ofillustration, specific embodiments in which the invention may bepracticed. These embodiments are described in sufficient detail toenable those skilled in the art to implement the present disclosure. Itshould be understood that various embodiments of the present disclosure,although different, are not necessarily mutually exclusive. For example,specific features, structures, and characteristics described herein, inconnection with one embodiment, may be implemented within otherembodiments without departing from the spirit and scope of the presentdisclosure. In addition, it should be understood that the location orarrangement of individual elements within each disclosed embodiment maybe modified without departing from the spirit and scope of the presentdisclosure. The following detailed description is, therefore, not to betaken in a limiting sense, and the scope of the present disclosure isdefined only by the appended claims, appropriately interpreted, alongwith the full range of equivalents to what the claims claim.

Terms used in the specification, ‘first’, ‘second’, etc. can be used todescribe various components, but the components are not to be construedas being limited to the terms. The terms are only used to differentiateone component from other components. For example, the ‘first’ componentmay be named the ‘second’ component without departing from the scope ofthe present invention, and the ‘second’ component may also be similarlynamed the ‘first’ component. The term ‘and/or’ includes a combination ofa plurality of items or any one of a plurality of terms.

It will be understood that when an element is simply referred to asbeing ‘connected to’ or ‘coupled to’ another element without being‘directly connected to’ or ‘directly coupled to’ another element in thepresent description, it may be ‘directly connected to’ or ‘directlycoupled to’ another element or be connected to or coupled to anotherelement, having the other element intervening therebetween. In contrast,it should be understood that when an element is referred to as being“directly coupled” or “directly connected” to another element, there areno intervening elements present.

Furthermore, constitutional parts shown in the embodiments of thepresent invention are independently shown so as to representcharacteristic functions different from each other. Thus, it does notmean that each constitutional part is constituted in a constitutionalunit of separated hardware or software. In other words, eachconstitutional part includes each of enumerated constitutional parts forconvenience. Thus, at least two constitutional parts of eachconstitutional part may be combined to form one constitutional part orone constitutional part may be divided into a plurality ofconstitutional parts to perform each function. The embodiment where eachconstitutional part is combined and the embodiment where oneconstitutional part is divided are also included in the scope of thepresent invention, if not departing from the essence of the presentinvention.

The terms used in the present specification are merely used to describeparticular embodiments, and are not intended to limit the presentinvention. An expression used in the singular encompasses the expressionof the plural, unless it has a clearly different meaning in the context.In the present specification, it is to be understood that terms such as“including”, “having”, etc. are intended to indicate the existence ofthe features, numbers, steps, actions, elements, parts, or combinationsthereof disclosed in the specification, and are not intended to precludethe possibility that one or more other features, numbers, steps,actions, elements, parts, or combinations thereof may exist or may beadded. In other words, when a specific element is referred to as being“included”, elements other than the corresponding element are notexcluded, but additional elements may be included in embodiments of thepresent invention or the scope of the present invention.

In addition, some of constituents may not be indispensable constituentsperforming essential functions of the present invention but be selectiveconstituents improving only performance thereof. The present inventionmay be implemented by including only the indispensable constitutionalparts for implementing the essence of the present invention except theconstituents used in improving performance. The structure including onlythe indispensable constituents except the selective constituents used inimproving only performance is also included in the scope of the presentinvention.

Hereinafter, embodiments of the present invention will be described indetail with reference to the accompanying drawings. In describingexemplary embodiments of the present invention, well-known functions orconstructions will not be described in detail since they mayunnecessarily obscure the understanding of the present invention. Thesame constituent elements in the drawings are denoted by the samereference numerals, and a repeated description of the same elements willbe omitted.

Hereinafter, an image may mean a picture configuring a video, or maymean the video itself. For example, “encoding or decoding or both of animage” may mean “encoding or decoding or both of a moving picture”, andmay mean “encoding or decoding or both of one image among images of amoving picture.”

Hereinafter, terms “moving picture” and “video” may be used as the samemeaning and be replaced with each other.

Hereinafter, a target image may be an encoding target image which is atarget of encoding and/or a decoding target image which is a target ofdecoding. Also, a target image may be an input image inputted to anencoding apparatus, and an input image inputted to a decoding apparatus.Here, a target image may have the same meaning with the current image.

Hereinafter, terms “image”, “picture, “frame” and “screen” may be usedas the same meaning and be replaced with each other.

Hereinafter, a target block may be an encoding target block which is atarget of encoding and/or a decoding target block which is a target ofdecoding. Also, a target block may be the current block which is atarget of current encoding and/or decoding. For example, terms “targetblock” and “current block” may be used as the same meaning and bereplaced with each other.

Hereinafter, terms “block” and “unit” may be used as the same meaningand be replaced with each other. Or a “block” may represent a specificunit.

Hereinafter, terms “region” and “segment” may be replaced with eachother.

Hereinafter, a specific signal may be a signal representing a specificblock. For example, an original signal may be a signal representing atarget block. A prediction signal may be a signal representing aprediction block. A residual signal may be a signal representing aresidual block.

In embodiments, each of specific information, data, flag, index, elementand attribute, etc. may have a value. A value of information, data,flag, index, element and attribute equal to “0” may represent a logicalfalse or the first predefined value. In other words, a value “0”, afalse, a logical false and the first predefined value may be replacedwith each other. A value of information, data, flag, index, element andattribute equal to “1” may represent a logical true or the secondpredefined value. In other words, a value “1”, a true, a logical trueand the second predefined value may be replaced with each other.

When a variable i or j is used for representing a column, a row or anindex, a value of i may be an integer equal to or greater than 0, orequal to or greater than 1. That is, the column, the row, the index,etc. may be counted from 0 or may be counted from 1.

Description of Terms

Encoder: means an apparatus performing encoding. That is, means anencoding apparatus.

Decoder: means an apparatus performing decoding. That is, means adecoding apparatus.

Block: is an M×N array of a sample. Herein, M and N may mean positiveintegers, and the block may mean a sample array of a two-dimensionalform. The block may refer to a unit. A current block my mean an encodingtarget block that becomes a target when encoding, or a decoding targetblock that becomes a target when decoding. In addition, the currentblock may be at least one of an encode block, a prediction block, aresidual block, and a transform block.

Sample: is a basic unit constituting a block. It may be expressed as avalue from 0 to 2^(Bd)−1 according to a bit depth (B_(d)). In thepresent invention, the sample may be used as a meaning of a pixel. Thatis, a sample, a pel, a pixel may have the same meaning with each other.

Unit: may refer to an encoding and decoding unit. When encoding anddecoding an image, the unit may be a region generated by partitioning asingle image. In addition, the unit may mean a subdivided unit when asingle image is partitioned into subdivided units during encoding ordecoding. That is, an image may be partitioned into a plurality ofunits. When encoding and decoding an image, a predetermined process foreach unit may be performed. A single unit may be partitioned intosub-units that have sizes smaller than the size of the unit. Dependingon functions, the unit may mean a block, a macroblock, a coding treeunit, a code tree block, a coding unit, a coding block), a predictionunit, a prediction block, a residual unit), a residual block, atransform unit, a transform block, etc. In addition, in order todistinguish a unit from a block, the unit may include a luma componentblock, a chroma component block associated with the luma componentblock, and a syntax element of each color component block. The unit mayhave various sizes and forms, and particularly, the form of the unit maybe a two-dimensional geometrical figure such as a square shape, arectangular shape, a trapezoid shape, a triangular shape, a pentagonalshape, etc. In addition, unit information may include at least one of aunit type indicating the coding unit, the prediction unit, the transformunit, etc., and a unit size, a unit depth, a sequence of encoding anddecoding of a unit, etc.

Coding Tree Unit: is configured with a single coding tree block of aluma component Y, and two coding tree blocks related to chromacomponents Cb and Cr. In addition, it may mean that including the blocksand a syntax element of each block. Each coding tree unit may bepartitioned by using at least one of a quad-tree partitioning method, abinary-tree partitioning method and ternary-tree partitioning method toconfigure a lower unit such as coding unit, prediction unit, transformunit, etc. It may be used as a term for designating a sample block thatbecomes a process unit when encoding/decoding an image as an inputimage. Here, the quad-tree may mean a quarternary-tree.

When the size of the coding block is within a predetermined range, thedivision is possible using only quad-tree partitioning. Here, thepredetermined range may be defined as at least one of a maximum size anda minimum size of a coding block in which the division is possible usingonly quad-tree partitioning. Information indicating a maximum/minimumsize of a coding block in which quad-tree partitioning is allowed may besignaled through a bitstream, and the information may be signaled in atleast one unit of a sequence, a picture parameter, a tile group, or aslice (segment). Alternatively, the maximum/minimum size of the codingblock may be a fixed size predetermined in the coder/decoder. Forexample, when the size of the coding block corresponds to 256×256 to64×64, the division is possible only using quad-tree partitioning.Alternatively, when the size of the coding block is larger than the sizeof the maximum conversion block, the division is possible only usingquad-tree partitioning. Herein, the block to be divided may be at leastone of a coding block and a transform block. In this case, informationindicating the division of the coded block (for example, split_flag) maybe a flag indicating whether or not to perform the quad-treepartitioning. When the size of the coding block falls within apredetermined range, the division is possible only using binary tree orternary tree partitioning. In this case, the above description of thequad-tree partitioning may be applied to binary tree partitioning orternary tree partitioning in the same manner.

Coding Tree Block: may be used as a term for designating any one of a Ycoding tree block, Cb coding tree block, and Cr coding tree block.

Neighbor Block: may mean a block adjacent to a current block. The blockadjacent to the current block may mean a block that comes into contactwith a boundary of the current block, or a block positioned within apredetermined distance from the current block. The neighbor block maymean a block adjacent to a vertex of the current block. Herein, theblock adjacent to the vertex of the current block may mean a blockvertically adjacent to a neighbor block that is horizontally adjacent tothe current block, or a block horizontally adjacent to a neighbor blockthat is vertically adjacent to the current block.

Reconstructed Neighbor block: may mean a neighbor block adjacent to acurrent block and which has been already spatially/temporally encoded ordecoded. Herein, the reconstructed neighbor block may mean areconstructed neighbor unit. A reconstructed spatial neighbor block maybe a block within a current picture and which has been alreadyreconstructed through encoding or decoding or both. A reconstructedtemporal neighbor block is a block at a corresponding position as thecurrent block of the current picture within a reference image, or aneighbor block thereof.

Unit Depth: may mean a partitioned degree of a unit. In a treestructure, the highest node (Root Node) may correspond to the first unitwhich is not partitioned. Also, the highest node may have the leastdepth value. In this case, the highest node may have a depth of level 0.A node having a depth of level 1 may represent a unit generated bypartitioning once the first unit. A node having a depth of level 2 mayrepresent a unit generated by partitioning twice the first unit. A nodehaving a depth of level n may represent a unit generated by partitioningn-times the first unit. A Leaf Node may be the lowest node and a nodewhich cannot be partitioned further. A depth of a Leaf Node may be themaximum level. For example, a predefined value of the maximum level maybe 3. A depth of a root node may be the lowest and a depth of a leafnode may be the deepest. In addition, when a unit is expressed as a treestructure, a level in which a unit is present may mean a unit depth.

Bitstream: may mean a bitstream including encoding image information.

Parameter Set: corresponds to header information among a configurationwithin a bitstream. At least one of a video parameter set, a sequenceparameter set, a picture parameter set, and an adaptation parameter setmay be included in a parameter set. In addition, a parameter set mayinclude a slice header, a tile group header, and tile headerinformation. The term “tile group” means a group of tiles and has thesame meaning as a slice.

An adaptation parameter set may mean a parameter set that can be sharedby being referred to in different pictures, subpictures, slices, tilegroups, tiles, or bricks. In addition, information in an adaptationparameter set may be used by referring to different adaptation parametersets for a subpicture, a slice, a tile group, a tile, or a brick insidea picture.

In addition, regarding the adaptation parameter set, differentadaptation parameter sets may be referred to by using identifiers ofdifferent adaptation parameter sets for a subpicture, a slice, a tilegroup, a tile, or a brick inside a picture.

In addition, regarding the adaptation parameter set, differentadaptation parameter sets may be referred to by using identifiers ofdifferent adaptation parameter sets for a slice, a tile group, a tile,or a brick inside a subpicture.

In addition, regarding the adaptation parameter set, differentadaptation parameter sets may be referred to by using identifiers ofdifferent adaptation parameter sets for a tile or a brick inside aslice.

In addition, regarding the adaptation parameter set, differentadaptation parameter sets may be referred to by using identifiers ofdifferent adaptation parameter sets for a brick inside a tile.

Information on an adaptation parameter set identifier may be included ina parameter set or a header of the subpicture, and an adaptationparameter set corresponding to the adaptation parameter set identifiermay be used for the subpicture.

The information on the adaptation parameter set identifier may beincluded in a parameter set or a header of the tile, and an adaptationparameter set corresponding to the adaptation parameter set identifiermay be used for the tile.

The information on the adaptation parameter set identifier may beincluded in a header of the brick, and an adaptation parameter setcorresponding to the adaptation parameter set identifier may be used forthe brick.

The picture may be partitioned into one or more tile rows and one ormore tile columns.

The subpicture may be partitioned into one or more tile rows and one ormore tile columns within a picture. The subpicture may be a regionhaving the form of a rectangle/square within a picture and may includeone or more CTUs. In addition, at least one or more tiles/bricks/slicesmay be included within one subpicture.

The tile may be a region having the form of a rectangle/square within apicture and may include one or more CTUs. In addition, the tile may bepartitioned into one or more bricks.

The brick may mean one or more CTU rows within a tile. The tile may bepartitioned into one or more bricks, and each brick may have at leastone or more CTU rows. A tile that is not partitioned into two or moremay mean a brick.

The slice may include one or more tiles within a picture and may includeone or more bricks within a tile.

Parsing: may mean determination of a value of a syntax element byperforming entropy decoding or may mean the entropy decoding itself.

Symbol: may mean at least one of a syntax element, a coding parameter,and a transform coefficient value of an encoding/decoding target unit.In addition, the symbol may mean an entropy encoding target or anentropy decoding result.

Prediction Mode: may be information indicating a mode encoded/decodedwith intra prediction or a mode encoded/decoded with inter prediction.

Prediction Unit: may mean a basic unit when performing prediction suchas inter-prediction, intra-prediction, inter-compensation,intra-compensation, and motion compensation. A single prediction unitmay be partitioned into a plurality of partitions having a smaller size,or may be partitioned into a plurality of lower prediction units. Aplurality of partitions may be a basic unit in performing prediction orcompensation. A partition which is generated by dividing a predictionunit may also be a prediction unit.

Prediction Unit Partition: may mean a form obtained by partitioning aprediction unit.

Reference picture list may refer to a list including one or morereference pictures used for inter prediction or motion compensation.There are several types of usable reference picture lists, including LC(List combined), L0 (List 0), L1 (List 1), L2 (List 2), L3 (List 3).

Inter prediction indicator may refer to a direction of inter prediction(unidirectional prediction, bidirectional prediction, etc.) of a currentblock. Alternatively, it may refer to the number of reference picturesused to generate a prediction block of a current block. Alternatively,it may refer to the number of prediction blocks used at the time ofperforming inter prediction or motion compensation on a current block.

Prediction list utilization flag indicates whether a prediction block isgenerated using at least one reference picture in a specific referencepicture list. An inter prediction indicator can be derived using aprediction list utilization flag, and conversely, a prediction listutilization flag can be derived using an inter prediction indicator. Forexample, when the prediction list utilization flag has a first value ofzero (0), it means that a reference picture in a reference picture listis not used to generate a prediction block. On the other hand, when theprediction list utilization flag has a second value of one (1), it meansthat a reference picture list is used to generate a prediction block.

Reference picture index may refer to an index indicating a specificreference picture in a reference picture list.

Reference picture may mean a reference picture which is referred to by aspecific block for the purposes of inter prediction or motioncompensation of the specific block. Alternatively, the reference picturemay be a picture including a reference block referred to by a currentblock for inter prediction or motion compensation. Hereinafter, theterms “reference picture” and “reference image” have the same meaningand can be interchangeably.

Motion vector may be a two-dimensional vector used for inter predictionor motion compensation. The motion vector may mean an offset between anencoding/decoding target block and a reference block. For example, (mvX,mvY) may represent a motion vector. Here, mvX may represent a horizontalcomponent and mvY may represent a vertical component.

Search range may be a two-dimensional region which is searched toretrieve a motion vector during inter prediction. For example, the sizeof the search range may be M×N. Here, M and N are both integers.

Motion vector candidate may refer to a prediction candidate block or amotion vector of the prediction candidate block when predicting a motionvector. In addition, a motion vector candidate may be included in amotion vector candidate list.

Motion vector candidate list may mean a list composed of one or moremotion vector candidates.

Motion vector candidate index may mean an indicator indicating a motionvector candidate in a motion vector candidate list. Alternatively, itmay be an index of a motion vector predictor.

Motion information may mean information including at least one of theitems including a motion vector, a reference picture index, an interprediction indicator, a prediction list utilization flag, referencepicture list information, a reference picture, a motion vectorcandidate, a motion vector candidate index, a merge candidate, and amerge index.

Merge candidate list may mean a list composed of one or more mergecandidates.

Merge candidate may mean a spatial merge candidate, a temporal mergecandidate, a combined merge candidate, a combined bi-predictive mergecandidate, or a zero merge candidate. The merge candidate may includemotion information such as an inter prediction indicator, a referencepicture index for each list, a motion vector, a prediction listutilization flag, and an inter prediction indicator.

Merge index may mean an indicator indicating a merge candidate in amerge candidate list. Alternatively, the merge index may indicate ablock from which a merge candidate has been derived, among reconstructedblocks spatially/temporally adjacent to a current block. Alternatively,the merge index may indicate at least one piece of motion information ofa merge candidate.

Transform Unit: may mean a basic unit when performing encoding/decodingsuch as transform, inverse-transform, quantization, dequantization,transform coefficient encoding/decoding of a residual signal. A singletransform unit may be partitioned into a plurality of lower-leveltransform units having a smaller size. Here,transformation/inverse-transformation may comprise at least one amongthe first transformation/the first inverse-transformation and the secondtransformation/the second inverse-transformation.

Scaling: may mean a process of multiplying a quantized level by afactor. A transform coefficient may be generated by scaling a quantizedlevel. The scaling also may be referred to as dequantization.

Quantization Parameter: may mean a value used when generating aquantized level using a transform coefficient during quantization. Thequantization parameter also may mean a value used when generating atransform coefficient by scaling a quantized level duringdequantization. The quantization parameter may be a value mapped on aquantization step size.

Delta Quantization Parameter: may mean a difference value between apredicted quantization parameter and a quantization parameter of anencoding/decoding target unit.

Scan: may mean a method of sequencing coefficients within a unit, ablock or a matrix. For example, changing a two-dimensional matrix ofcoefficients into a one-dimensional matrix may be referred to asscanning, and changing a one-dimensional matrix of coefficients into atwo-dimensional matrix may be referred to as scanning or inversescanning.

Transform coefficient: may mean a coefficient value generated aftertransform is performed in an encoder. It may mean a coefficient valuegenerated after at least one of entropy decoding and dequantization isperformed in a decoder. A quantized level obtained by quantizing atransform coefficient or a residual signal, or a quantized transformcoefficient level also may fall within the meaning of the transformcoefficient.

Quantized Level: may mean a value generated by quantizing a transformcoefficient or a residual signal in an encoder. Alternatively, thequantized level may mean a value that is a dequantization target toundergo dequantization in a decoder. Similarly, a quantized transformcoefficient level that is a result of transform and quantization alsomay fall within the meaning of the quantized level.

Non-zero Transform Coefficient: may mean a transform coefficient havinga value other than zero, or a transform coefficient level or a quantizedlevel having a value other than zero.

Quantization Matrix: may mean a matrix used in a quantization process ora dequantization process performed to improve subjective or objectiveimage quality. The quantization matrix also may be referred to as ascaling list.

Quantization Matrix Coefficient: may mean each element within aquantization matrix. The quantization matrix coefficient also may bereferred to as a matrix coefficient.

Default Matrix: may mean a predetermined quantization matrixpreliminarily defined in an encoder or a decoder.

Non-default Matrix: may mean a quantization matrix that is notpreliminarily defined in an encoder or a decoder but is signaled by auser.

Statistic Value: a statistic value for at least one among a variable, anencoding parameter, a constant value, etc. which have a computablespecific value may be one or more among an average value, a sum value, aweighted average value, a weighted sum value, the minimum value, themaximum value, the most frequent value, a median value, an interpolatedvalue of the corresponding specific values.

FIG. 1 is a block diagram showing a configuration of an encodingapparatus according to an embodiment to which the present invention isapplied.

An encoding apparatus 100 may be an encoder, a video encoding apparatus,or an image encoding apparatus. A video may include at least one image.The encoding apparatus 100 may sequentially encode at least one image.

Referring to FIG. 1, the encoding apparatus 100 may include a motionprediction unit 111, a motion compensation unit 112, an intra-predictionunit 120, a switch 115, a subtractor 125, a transform unit 130, aquantization unit 140, an entropy encoding unit 150, a dequantizationunit 160, an inverse-transform unit 170, an adder 175, a filter unit180, and a reference picture buffer 190.

The encoding apparatus 100 may perform encoding of an input image byusing an intra mode or an inter mode or both. In addition, encodingapparatus 100 may generate a bitstream including encoded informationthrough encoding the input image, and output the generated bitstream.The generated bitstream may be stored in a computer readable recordingmedium, or may be streamed through a wired/wireless transmission medium.When an intra mode is used as a prediction mode, the switch 115 may beswitched to an intra. Alternatively, when an inter mode is used as aprediction mode, the switch 115 may be switched to an inter mode.Herein, the intra mode may mean an intra-prediction mode, and the intermode may mean an inter-prediction mode. The encoding apparatus 100 maygenerate a prediction block for an input block of the input image. Inaddition, the encoding apparatus 100 may encode a residual block using aresidual of the input block and the prediction block after theprediction block being generated. The input image may be called as acurrent image that is a current encoding target. The input block may becalled as a current block that is current encoding target, or as anencoding target block.

When a prediction mode is an intra mode, the intra-prediction unit 120may use a sample of a block that has been already encoded/decoded and isadjacent to a current block as a reference sample. The intra-predictionunit 120 may perform spatial prediction for the current block by using areference sample, or generate prediction samples of an input block byperforming spatial prediction. Herein, the intra prediction may meanintra-prediction,

When a prediction mode is an inter mode, the motion prediction unit 111may retrieve a region that best matches with an input block from areference image when performing motion prediction, and deduce a motionvector by using the retrieved region. In this case, a search region maybe used as the region. The reference image may be stored in thereference picture buffer 190. Here, when encoding/decoding for thereference image is performed, it may be stored in the reference picturebuffer 190.

The motion compensation unit 112 may generate a prediction block byperforming motion compensation for the current block using a motionvector. Herein, inter-prediction may mean inter-prediction or motioncompensation.

When the value of the motion vector is not an integer, the motionprediction unit 111 and the motion compensation unit 112 may generatethe prediction block by applying an interpolation filter to a partialregion of the reference picture. In order to perform inter-pictureprediction or motion compensation on a coding unit, it may be determinedthat which mode among a skip mode, a merge mode, an advanced motionvector prediction (AMVP) mode, and a current picture referring mode isused for motion prediction and motion compensation of a prediction unitincluded in the corresponding coding unit. Then, inter-pictureprediction or motion compensation may be differently performed dependingon the determined mode.

The subtractor 125 may generate a residual block by using a differenceof an input block and a prediction block. The residual block may becalled as a residual signal. The residual signal may mean a differencebetween an original signal and a prediction signal. In addition, theresidual signal may be a signal generated by transforming or quantizing,or transforming and quantizing a difference between the original signaland the prediction signal. The residual block may be a residual signalof a block unit.

The transform unit 130 may generate a transform coefficient byperforming transform of a residual block, and output the generatedtransform coefficient. Herein, the transform coefficient may be acoefficient value generated by performing transform of the residualblock. When a transform skip mode is applied, the transform unit 130 mayskip transform of the residual block.

A quantized level may be generated by applying quantization to thetransform coefficient or to the residual signal. Hereinafter, thequantized level may be also called as a transform coefficient inembodiments.

The quantization unit 140 may generate a quantized level by quantizingthe transform coefficient or the residual signal according to aparameter, and output the generated quantized level. Herein, thequantization unit 140 may quantize the transform coefficient by using aquantization matrix.

The entropy encoding unit 150 may generate a bitstream by performingentropy encoding according to a probability distribution on valuescalculated by the quantization unit 140 or on coding parameter valuescalculated when performing encoding, and output the generated bitstream.The entropy encoding unit 150 may perform entropy encoding of sampleinformation of an image and information for decoding an image. Forexample, the information for decoding the image may include a syntaxelement.

When entropy encoding is applied, symbols are represented so that asmaller number of bits are assigned to a symbol having a high chance ofbeing generated and a larger number of bits are assigned to a symbolhaving a low chance of being generated, and thus, the size of bit streamfor symbols to be encoded may be decreased. The entropy encoding unit150 may use an encoding method for entropy encoding such as exponentialGolomb, context-adaptive variable length coding (CAVLC),context-adaptive binary arithmetic coding (CABAC), etc. For example, theentropy encoding unit 150 may perform entropy encoding by using avariable length coding/code (VLC) table. In addition, the entropyencoding unit 150 may deduce a binarization method of a target symboland a probability model of a target symbol/bin, and perform arithmeticcoding by using the deduced binarization method, and a context model.

In order to encode a transform coefficient level (quantized level), theentropy encoding unit 150 may change a two-dimensional block formcoefficient into a one-dimensional vector form by using a transformcoefficient scanning method.

A coding parameter may include information (flag, index, etc.) such assyntax element that is encoded in an encoder and signaled to a decoder,and information derived when performing encoding or decoding. The codingparameter may mean information required when encoding or decoding animage. For example, at least one value or a combination form of aunit/block size, a unit/block depth, unit/block partition information,unit/block shape, unit/block partition structure, whether to partitionof a quad-tree form, whether to partition of a binary-tree form, apartition direction of a binary-tree form (horizontal direction orvertical direction), a partition form of a binary-tree form (symmetricpartition or asymmetric partition), whether or not a current coding unitis partitioned by ternary tree partitioning, direction (horizontal orvertical direction) of the ternary tree partitioning, type (symmetric orasymmetric type) of the ternary tree partitioning, whether a currentcoding unit is partitioned by multi-type tree partitioning, direction(horizontal or vertical direction) of the multi-type three partitioning,type (symmetric or asymmetric type) of the multi-type tree partitioning,and a tree (binary tree or ternary tree) structure of the multi-typetree partitioning, a prediction mode (intra prediction or interprediction), a luma intra-prediction mode/direction, a chromaintra-prediction mode/direction, intra partition information, interpartition information, a coding block partition flag, a prediction blockpartition flag, a transform block partition flag, a reference samplefiltering method, a reference sample filter tab, a reference samplefilter coefficient, a prediction block filtering method, a predictionblock filter tap, a prediction block filter coefficient, a predictionblock boundary filtering method, a prediction block boundary filter tab,a prediction block boundary filter coefficient, an intra-predictionmode, an inter-prediction mode, motion information, a motion vector, amotion vector difference, a reference picture index, a inter-predictionangle, an inter-prediction indicator, a prediction list utilizationflag, a reference picture list, a reference picture, a motion vectorpredictor index, a motion vector predictor candidate, a motion vectorcandidate list, whether to use a merge mode, a merge index, a mergecandidate, a merge candidate list, whether to use a skip mode, aninterpolation filter type, an interpolation filter tab, an interpolationfilter coefficient, a motion vector size, a presentation accuracy of amotion vector, a transform type, a transform size, information ofwhether or not a primary (first) transform is used, information ofwhether or not a secondary transform is used, a primary transform index,a secondary transform index, information of whether or not a residualsignal is present, a coded block pattern, a coded block flag (CBF), aquantization parameter, a quantization parameter residue, a quantizationmatrix, whether to apply an intra loop filter, an intra loop filtercoefficient, an intra loop filter tab, an intra loop filter shape/form,whether to apply a deblocking filter, a deblocking filter coefficient, adeblocking filter tab, a deblocking filter strength, a deblocking filtershape/form, whether to apply an adaptive sample offset, an adaptivesample offset value, an adaptive sample offset category, an adaptivesample offset type, whether to apply an adaptive loop filter, anadaptive loop filter coefficient, an adaptive loop filter tab, anadaptive loop filter shape/form, a binarization/inverse-binarizationmethod, a context model determining method, a context model updatingmethod, whether to perform a regular mode, whether to perform a bypassmode, a context bin, a bypass bin, a significant coefficient flag, alast significant coefficient flag, a coded flag for a unit of acoefficient group, a position of the last significant coefficient, aflag for whether a value of a coefficient is larger than 1, a flag forwhether a value of a coefficient is larger than 2, a flag for whether avalue of a coefficient is larger than 3, information on a remainingcoefficient value, a sign information, a reconstructed luma sample, areconstructed chroma sample, a residual luma sample, a residual chromasample, a luma transform coefficient, a chroma transform coefficient, aquantized luma level, a quantized chroma level, a transform coefficientlevel scanning method, a size of a motion vector search area at adecoder side, a shape of a motion vector search area at a decoder side,a number of time of a motion vector search at a decoder side,information on a CTU size, information on a minimum block size,information on a maximum block size, information on a maximum blockdepth, information on a minimum block depth, an imagedisplaying/outputting sequence, slice identification information, aslice type, slice partition information, tile identificationinformation, a tile type, tile partition information, tile groupidentification information, a tile group type, tile group partitioninformation, a picture type, a bit depth of an input sample, a bit depthof a reconstruction sample, a bit depth of a residual sample, a bitdepth of a transform coefficient, a bit depth of a quantized level, andinformation on a luma signal or information on a chroma signal may beincluded in the coding parameter.

Herein, signaling the flag or index may mean that a corresponding flagor index is entropy encoded and included in a bitstream by an encoder,and may mean that the corresponding flag or index is entropy decodedfrom a bitstream by a decoder.

When the encoding apparatus 100 performs encoding throughinter-prediction, an encoded current image may be used as a referenceimage for another image that is processed afterwards. Accordingly, theencoding apparatus 100 may reconstruct or decode the encoded currentimage, or store the reconstructed or decoded image as a reference imagein reference picture buffer 190.

A quantized level may be dequantized in the dequantization unit 160, ormay be inverse-transformed in the inverse-transform unit 170. Adequantized or inverse-transformed coefficient or both may be added witha prediction block by the adder 175. By adding the dequantized orinverse-transformed coefficient or both with the prediction block, areconstructed block may be generated. Herein, the dequantized orinverse-transformed coefficient or both may mean a coefficient on whichat least one of dequantization and inverse-transform is performed, andmay mean a reconstructed residual block.

A reconstructed block may pass through the filter unit 180. The filterunit 180 may apply at least one of a deblocking filter, a sampleadaptive offset (SAO), and an adaptive loop filter (ALF) to areconstructed sample, a reconstructed block or a reconstructed image.The filter unit 180 may be called as an in-loop filter.

The deblocking filter may remove block distortion generated inboundaries between blocks. In order to determine whether or not to applya deblocking filter, whether or not to apply a deblocking filter to acurrent block may be determined based samples included in several rowsor columns which are included in the block. When a deblocking filter isapplied to a block, another filter may be applied according to arequired deblocking filtering strength.

In order to compensate an encoding error, a proper offset value may beadded to a sample value by using a sample adaptive offset. The sampleadaptive offset may correct an offset of a deblocked image from anoriginal image by a sample unit. A method of partitioning samples of animage into a predetermined number of regions, determining a region towhich an offset is applied, and applying the offset to the determinedregion, or a method of applying an offset in consideration of edgeinformation on each sample may be used.

The adaptive loop filter may perform filtering based on a comparisonresult of the filtered reconstructed image and the original image.Samples included in an image may be partitioned into predeterminedgroups, a filter to be applied to each group may be determined, anddifferential filtering may be performed for each group. Information ofwhether or not to apply the ALF may be signaled by coding units (CUs),and a form and coefficient of the ALF to be applied to each block mayvary.

The reconstructed block or the reconstructed image having passed throughthe filter unit 180 may be stored in the reference picture buffer 190. Areconstructed block processed by the filter unit 180 may be a part of areference image. That is, a reference image is a reconstructed imagecomposed of reconstructed blocks processed by the filter unit 180. Thestored reference image may be used later in inter prediction or motioncompensation.

FIG. 2 is a block diagram showing a configuration of a decodingapparatus according to an embodiment and to which the present inventionis applied.

A decoding apparatus 200 may a decoder, a video decoding apparatus, oran image decoding apparatus.

Referring to FIG. 2, the decoding apparatus 200 may include an entropydecoding unit 210, a dequantization unit 220, an inverse-transform unit230, an intra-prediction unit 240, a motion compensation unit 250, anadder 225, a filter unit 260, and a reference picture buffer 270.

The decoding apparatus 200 may receive a bitstream output from theencoding apparatus 100. The decoding apparatus 200 may receive abitstream stored in a computer readable recording medium, or may receivea bitstream that is streamed through a wired/wireless transmissionmedium. The decoding apparatus 200 may decode the bitstream by using anintra mode or an inter mode. In addition, the decoding apparatus 200 maygenerate a reconstructed image generated through decoding or a decodedimage, and output the reconstructed image or decoded image.

When a prediction mode used when decoding is an intra mode, a switch maybe switched to an intra. Alternatively, when a prediction mode used whendecoding is an inter mode, a switch may be switched to an inter mode.

The decoding apparatus 200 may obtain a reconstructed residual block bydecoding the input bitstream, and generate a prediction block. When thereconstructed residual block and the prediction block are obtained, thedecoding apparatus 200 may generate a reconstructed block that becomes adecoding target by adding the reconstructed residual block with theprediction block. The decoding target block may be called a currentblock.

The entropy decoding unit 210 may generate symbols by entropy decodingthe bitstream according to a probability distribution. The generatedsymbols may include a symbol of a quantized level form. Herein, anentropy decoding method may be an inverse-process of the entropyencoding method described above.

In order to decode a transform coefficient level (quantized level), theentropy decoding unit 210 may change a one-directional vector formcoefficient into a two-dimensional block form by using a transformcoefficient scanning method.

A quantized level may be dequantized in the dequantization unit 220, orinverse-transformed in the inverse-transform unit 230. The quantizedlevel may be a result of dequantizing or inverse-transforming or both,and may be generated as a reconstructed residual block. Herein, thedequantization unit 220 may apply a quantization matrix to the quantizedlevel.

When an intra mode is used, the intra-prediction unit 240 may generate aprediction block by performing, for the current block, spatialprediction that uses a sample value of a block adjacent to a decodingtarget block and which has been already decoded.

When an inter mode is used, the motion compensation unit 250 maygenerate a prediction block by performing, for the current block, motioncompensation that uses a motion vector and a reference image stored inthe reference picture buffer 270.

The adder 225 may generate a reconstructed block by adding thereconstructed residual block with the prediction block. The filter unit260 may apply at least one of a deblocking filter, a sample adaptiveoffset, and an adaptive loop filter to the reconstructed block orreconstructed image. The filter unit 260 may output the reconstructedimage. The reconstructed block or reconstructed image may be stored inthe reference picture buffer 270 and used when performinginter-prediction. A reconstructed block processed by the filter unit 260may be a part of a reference image. That is, a reference image is areconstructed image composed of reconstructed blocks processed by thefilter unit 260. The stored reference image may be used later in interprediction or motion compensation.

FIG. 3 is a view schematically showing a partition structure of an imagewhen encoding and decoding the image. FIG. 3 schematically shows anexample of partitioning a single unit into a plurality of lower units.

In order to efficiently partition an image, when encoding and decoding,a coding unit (CU) may be used. The coding unit may be used as a basicunit when encoding/decoding the image. In addition, the coding unit maybe used as a unit for distinguishing an intra prediction mode and aninter prediction mode when encoding/decoding the image. The coding unitmay be a basic unit used for prediction, transform, quantization,inverse-transform, dequantization, or an encoding/decoding process of atransform coefficient.

Referring to FIG. 3, an image 300 is sequentially partitioned in alargest coding unit (LCU), and an LCU unit is determined as a partitionstructure. Herein, the LCU may be used in the same meaning as a codingtree unit (CTU). A unit partitioning may mean partitioning a blockassociated with to the unit. In block partition information, informationof a unit depth may be included. Depth information may represent anumber of times or a degree or both in which a unit is partitioned. Asingle unit may be partitioned into a plurality of lower level unitshierarchically associated with depth information based on a treestructure. In other words, a unit and a lower level unit generated bypartitioning the unit may correspond to a node and a child node of thenode, respectively. Each of partitioned lower unit may have depthinformation. Depth information may be information representing a size ofa CU, and may be stored in each CU. Unit depth represents times and/ordegrees related to partitioning a unit. Therefore, partitioninginformation of a lower-level unit may comprise information on a size ofthe lower-level unit.

A partition structure may mean a distribution of a coding unit (CU)within an LCU 310. Such a distribution may be determined according towhether or not to partition a single CU into a plurality (positiveinteger equal to or greater than 2 including 2, 4, 8, 16, etc.) of CUs.A horizontal size and a vertical size of the CU generated bypartitioning may respectively be half of a horizontal size and avertical size of the CU before partitioning, or may respectively havesizes smaller than a horizontal size and a vertical size beforepartitioning according to a number of times of partitioning. The CU maybe recursively partitioned into a plurality of CUs. By the recursivepartitioning, at least one among a height and a width of a CU afterpartitioning may decrease comparing with at least one among a height anda width of a CU before partitioning. Partitioning of the CU may berecursively performed until to a predefined depth or predefined size.For example, a depth of an LCU may be 0, and a depth of a smallestcoding unit (SCU) may be a predefined maximum depth. Herein, the LCU maybe a coding unit having a maximum coding unit size, and the SCU may be acoding unit having a minimum coding unit size as described above.Partitioning is started from the LCU 310, a CU depth increases by 1 as ahorizontal size or a vertical size or both of the CU decreases bypartitioning. For example, for each depth, a CU which is not partitionedmay have a size of 2N×2N. Also, in case of a CU which is partitioned, aCU with a size of 2N×2N may be partitioned into four CUs with a size ofN×N. A size of N may decrease to half as a depth increase by 1.

In addition, information whether or not the CU is partitioned may berepresented by using partition information of the CU. The partitioninformation may be 1-bit information. All CUs, except for a SCU, mayinclude partition information. For example, when a value of partitioninformation is a first value, the CU may not be partitioned, when avalue of partition information is a second value, the CU may bepartitioned

Referring to FIG. 3, an LCU having a depth 0 may be a 64×64 block. 0 maybe a minimum depth. A SCU having a depth 3 may be an 8×8 block. 3 may bea maximum depth. A CU of a 32×32 block and a 16×16 block may berespectively represented as a depth 1 and a depth 2.

For example, when a single coding unit is partitioned into four codingunits, a horizontal size and a vertical size of the four partitionedcoding units may be a half size of a horizontal and vertical size of theCU before being partitioned. In one embodiment, when a coding unithaving a 32×32 size is partitioned into four coding units, each of thefour partitioned coding units may have a 16×16 size. When a singlecoding unit is partitioned into four coding units, it may be called thatthe coding unit may be partitioned into a quad-tree form.

For example, when one coding unit is partitioned into two sub-codingunits, the horizontal or vertical size (width or height) of each of thetwo sub-coding units may be half the horizontal or vertical size of theoriginal coding unit. For example, when a coding unit having a size of32×32 is vertically partitioned into two sub-coding units, each of thetwo sub-coding units may have a size of 16×32. For example, when acoding unit having a size of 8×32 is horizontally partitioned into twosub-coding units, each of the two sub-coding units may have a size of8×16. When one coding unit is partitioned into two sub-coding units, itcan be said that the coding unit is binary-partitioned or is partitionedby a binary tree partition structure.

For example, when one coding unit is partitioned into three sub-codingunits, the horizontal or vertical size of the coding unit can bepartitioned with a ratio of 1:2:1, thereby producing three sub-codingunits whose horizontal or vertical sizes are in a ratio of 1:2:1. Forexample, when a coding unit having a size of 16×32 is horizontallypartitioned into three sub-coding units, the three sub-coding units mayhave sizes of 16×8, 16×16, and 16×8 respectively, in the order from theuppermost to the lowermost sub-coding unit. For example, when a codingunit having a size of 32×32 is vertically split into three sub-codingunits, the three sub-coding units may have sizes of 8×32, 16×32, and8×32, respectively in the order from the left to the right sub-codingunit. When one coding unit is partitioned into three sub-coding units,it can be said that the coding unit is ternary-partitioned orpartitioned by a ternary tree partition structure.

In FIG. 3, a coding tree unit (CTU) 320 is an example of a CTU to whicha quad tree partition structure, a binary tree partition structure, anda ternary tree partition structure are all applied.

As described above, in order to partition the CTU, at least one of aquad tree partition structure, a binary tree partition structure, and aternary tree partition structure may be applied. Various tree partitionstructures may be sequentially applied to the CTU, according to apredetermined priority order. For example, the quad tree partitionstructure may be preferentially applied to the CTU. A coding unit thatcannot be partitioned any longer using a quad tree partition structuremay correspond to a leaf node of a quad tree. A coding unitcorresponding to a leaf node of a quad tree may serve as a root node ofa binary and/or ternary tree partition structure. That is, a coding unitcorresponding to a leaf node of a quad tree may be further partitionedby a binary tree partition structure or a ternary tree partitionstructure, or may not be further partitioned. Therefore, by preventing acoding block that results from binary tree partitioning or ternary treepartitioning of a coding unit corresponding to a leaf node of a quadtree from undergoing further quad tree partitioning, block partitioningand/or signaling of partition information can be effectively performed.

The fact that a coding unit corresponding to a node of a quad tree ispartitioned may be signaled using quad partition information. The quadpartition information having a first value (e.g., “1”) may indicate thata current coding unit is partitioned by the quad tree partitionstructure. The quad partition information having a second value (e.g.,“0”) may indicate that a current coding unit is not partitioned by thequad tree partition structure. The quad partition information may be aflag having a predetermined length (e.g., one bit).

There may not be a priority between the binary tree partitioning and theternary tree partitioning. That is, a coding unit corresponding to aleaf node of a quad tree may further undergo arbitrary partitioningamong the binary tree partitioning and the ternary tree partitioning. Inaddition, a coding unit generated through the binary tree partitioningor the ternary tree partitioning may undergo a further binary treepartitioning or a further ternary tree partitioning, or may not befurther partitioned.

A tree structure in which there is no priority among the binary treepartitioning and the ternary tree partitioning is referred to as amulti-type tree structure. A coding unit corresponding to a leaf node ofa quad tree may serve as a root node of a multi-type tree. Whether topartition a coding unit which corresponds to a node of a multi-type treemay be signaled using at least one of multi-type tree partitionindication information, partition direction information, and partitiontree information. For partitioning of a coding unit corresponding to anode of a multi-type tree, the multi-type tree partition indicationinformation, the partition direction, and the partition tree informationmay be sequentially signaled.

The multi-type tree partition indication information having a firstvalue (e.g., “1”) may indicate that a current coding unit is to undergoa multi-type tree partitioning. The multi-type tree partition indicationinformation having a second value (e.g., “0”) may indicate that acurrent coding unit is not to undergo a multi-type tree partitioning.

When a coding unit corresponding to a node of a multi-type tree isfurther partitioned by a multi-type tree partition structure, the codingunit may include partition direction information. The partitiondirection information may indicate in which direction a current codingunit is to be partitioned for the multi-type tree partitioning. Thepartition direction information having a first value (e.g., “1”) mayindicate that a current coding unit is to be vertically partitioned. Thepartition direction information having a second value (e.g., “0”) mayindicate that a current coding unit is to be horizontally partitioned.

When a coding unit corresponding to a node of a multi-type tree isfurther partitioned by a multi-type tree partition structure, thecurrent coding unit may include partition tree information. Thepartition tree information may indicate a tree partition structure whichis to be used for partitioning of a node of a multi-type tree. Thepartition tree information having a first value (e.g., “1”) may indicatethat a current coding unit is to be partitioned by a binary treepartition structure. The partition tree information having a secondvalue (e.g., “0”) may indicate that a current coding unit is to bepartitioned by a ternary tree partition structure.

The partition indication information, the partition tree information,and the partition direction information may each be a flag having apredetermined length (e.g., one bit).

At least any one of the quadtree partition indication information, themulti-type tree partition indication information, the partitiondirection information, and the partition tree information may be entropyencoded/decoded. For the entropy-encoding/decoding of those types ofinformation, information on a neighboring coding unit adjacent to thecurrent coding unit may be used. For example, there is a highprobability that the partition type (the partitioned or non-partitioned,the partition tree, and/or the partition direction) of a leftneighboring coding unit and/or an upper neighboring coding unit of acurrent coding unit is similar to that of the current coding unit.Therefore, context information for entropy encoding/decoding of theinformation on the current coding unit may be derived from theinformation on the neighboring coding units. The information on theneighboring coding units may include at least any one of quad partitioninformation, multi-type tree partition indication information, partitiondirection information, and partition tree information.

As another example, among binary tree partitioning and ternary treepartitioning, binary tree partitioning may be preferentially performed.That is, a current coding unit may primarily undergo binary treepartitioning, and then a coding unit corresponding to a leaf node of abinary tree may be set as a root node for ternary tree partitioning. Inthis case, neither quad tree partitioning nor binary tree partitioningmay not be performed on the coding unit corresponding to a node of aternary tree.

A coding unit that cannot be partitioned by a quad tree partitionstructure, a binary tree partition structure, and/or a ternary treepartition structure becomes a basic unit for coding, prediction and/ortransformation. That is, the coding unit cannot be further partitionedfor prediction and/or transformation. Therefore, the partition structureinformation and the partition information used for partitioning a codingunit into prediction units and/or transformation units may not bepresent in a bit stream.

However, when the size of a coding unit (i.e., a basic unit forpartitioning) is larger than the size of a maximum transformation block,the coding unit may be recursively partitioned until the size of thecoding unit is reduced to be equal to or smaller than the size of themaximum transformation block. For example, when the size of a codingunit is 64×64 and when the size of a maximum transformation block is32×32, the coding unit may be partitioned into four 32×32 blocks fortransformation. For example, when the size of a coding unit is 32×64 andthe size of a maximum transformation block is 32×32, the coding unit maybe partitioned into two 32×32 blocks for the transformation. In thiscase, the partitioning of the coding unit for transformation is notsignaled separately, and may be determined through comparison betweenthe horizontal or vertical size of the coding unit and the horizontal orvertical size of the maximum transformation block. For example, when thehorizontal size (width) of the coding unit is larger than the horizontalsize (width) of the maximum transformation block, the coding unit may bevertically bisected. For example, when the vertical size (height) of thecoding unit is larger than the vertical size (height) of the maximumtransformation block, the coding unit may be horizontally bisected.

Information of the maximum and/or minimum size of the coding unit andinformation of the maximum and/or minimum size of the transformationblock may be signaled or determined at an upper level of the codingunit. The upper level may be, for example, a sequence level, a picturelevel, a slice level, a tile group level, a tile level, or the like. Forexample, the minimum size of the coding unit may be determined to be4×4. For example, the maximum size of the transformation block may bedetermined to be 64×64. For example, the minimum size of thetransformation block may be determined to be 4×4.

Information of the minimum size (quad tree minimum size) of a codingunit corresponding to a leaf node of a quad tree and/or information ofthe maximum depth (the maximum tree depth of a multi-type tree) from aroot node to a leaf node of the multi-type tree may be signaled ordetermined at an upper level of the coding unit. For example, the upperlevel may be a sequence level, a picture level, a slice level, a tilegroup level, a tile level, or the like. Information of the minimum sizeof a quad tree and/or information of the maximum depth of a multi-typetree may be signaled or determined for each of an intra-picture sliceand an inter-picture slice.

Difference information between the size of a CTU and the maximum size ofa transformation block may be signaled or determined at an upper levelof the coding unit. For example, the upper level may be a sequencelevel, a picture level, a slice level, a tile group level, a tile level,or the like. Information of the maximum size of the coding unitscorresponding to the respective nodes of a binary tree (hereinafter,referred to as a maximum size of a binary tree) may be determined basedon the size of the coding tree unit and the difference information. Themaximum size of the coding units corresponding to the respective nodesof a ternary tree (hereinafter, referred to as a maximum size of aternary tree) may vary depending on the type of slice. For example, foran intra-picture slice, the maximum size of a ternary tree may be 32×32.For example, for an inter-picture slice, the maximum size of a ternarytree may be 128×128. For example, the minimum size of the coding unitscorresponding to the respective nodes of a binary tree (hereinafter,referred to as a minimum size of a binary tree) and/or the minimum sizeof the coding units corresponding to the respective nodes of a ternarytree (hereinafter, referred to as a minimum size of a ternary tree) maybe set as the minimum size of a coding block.

As another example, the maximum size of a binary tree and/or the maximumsize of a ternary tree may be signaled or determined at the slice level.Alternatively, the minimum size of the binary tree and/or the minimumsize of the ternary tree may be signaled or determined at the slicelevel.

Depending on size and depth information of the above-described variousblocks, quad partition information, multi-type tree partition indicationinformation, partition tree information and/or partition directioninformation may be included or may not be included in a bit stream.

For example, when the size of the coding unit is not larger than theminimum size of a quad tree, the coding unit does not contain quadpartition information. Thus, the quad partition information may bededuced from a second value.

For example, when the sizes (horizontal and vertical sizes) of a codingunit corresponding to a node of a multi-type tree are larger than themaximum sizes (horizontal and vertical sizes) of a binary tree and/orthe maximum sizes (horizontal and vertical sizes) of a ternary tree, thecoding unit may not be binary-partitioned or ternary-partitioned.Accordingly, the multi-type tree partition indication information maynot be signaled but may be deduced from a second value.

Alternatively, when the sizes (horizontal and vertical sizes) of acoding unit corresponding to a node of a multi-type tree are the same asthe maximum sizes (horizontal and vertical sizes) of a binary treeand/or are two times as large as the maximum sizes (horizontal andvertical sizes) of a ternary tree, the coding unit may not be furtherbinary-partitioned or ternary-partitioned. Accordingly, the multi-typetree partition indication information may not be signaled but be derivedfrom a second value. This is because when a coding unit is partitionedby a binary tree partition structure and/or a ternary tree partitionstructure, a coding unit smaller than the minimum size of a binary treeand/or the minimum size of a ternary tree is generated.

Alternatively, the binary tree partitioning or the ternary treepartitioning may be limited on the basis of the size of a virtualpipeline data unit (hereinafter, a pipeline buffer size). For example,when the coding unit is divided into sub-coding units which do not fitthe pipeline buffer size by the binary tree partitioning or the ternarytree partitioning, the corresponding binary tree partitioning or ternarytree partitioning may be limited. The pipeline buffer size may be thesize of the maximum transform block (e.g., 64×64). For example, when thepipeline buffer size is 64×64, the division below may be limited.

-   -   N×M (N and/or M is 128) Ternary tree partitioning for coding        units    -   128×N (N<=64) Binary tree partitioning in horizontal direction        for coding units    -   N×128 (N<=64) Binary tree partitioning in vertical direction for        coding units

Alternatively, when the depth of a coding unit corresponding to a nodeof a multi-type tree is equal to the maximum depth of the multi-typetree, the coding unit may not be further binary-partitioned and/orternary-partitioned. Accordingly, the multi-type tree partitionindication information may not be signaled but may be deduced from asecond value.

Alternatively, only when at least one of vertical direction binary treepartitioning, horizontal direction binary tree partitioning, verticaldirection ternary tree partitioning, and horizontal direction ternarytree partitioning is possible for a coding unit corresponding to a nodeof a multi-type tree, the multi-type tree partition indicationinformation may be signaled. Otherwise, the coding unit may not bebinary-partitioned and/or ternary-partitioned. Accordingly, themulti-type tree partition indication information may not be signaled butmay be deduced from a second value.

Alternatively, only when both of the vertical direction binary treepartitioning and the horizontal direction binary tree partitioning orboth of the vertical direction ternary tree partitioning and thehorizontal direction ternary tree partitioning are possible for a codingunit corresponding to a node of a multi-type tree, the partitiondirection information may be signaled. Otherwise, the partitiondirection information may not be signaled but may be derived from avalue indicating possible partitioning directions.

Alternatively, only when both of the vertical direction binary treepartitioning and the vertical direction ternary tree partitioning orboth of the horizontal direction binary tree partitioning and thehorizontal direction ternary tree partitioning are possible for a codingtree corresponding to a node of a multi-type tree, the partition treeinformation may be signaled. Otherwise, the partition tree informationmay not be signaled but be deduced from a value indicating a possiblepartitioning tree structure.

FIG. 4 is a view showing an intra-prediction process.

Arrows from center to outside in FIG. 4 may represent predictiondirections of intra prediction modes.

Intra encoding and/or decoding may be performed by using a referencesample of a neighbor block of the current block. A neighbor block may bea reconstructed neighbor block. For example, intra encoding and/ordecoding may be performed by using an encoding parameter or a value of areference sample included in a reconstructed neighbor block.

A prediction block may mean a block generated by performing intraprediction. A prediction block may correspond to at least one among CU,PU and TU. A unit of a prediction block may have a size of one among CU,PU and TU. A prediction block may be a square block having a size of2×2, 4×4, 16×16, 32×32 or 64×64 etc. or may be a rectangular blockhaving a size of 2×8, 4×8, 2×16, 4×16 and 8×16 etc.

Intra prediction may be performed according to intra prediction mode forthe current block. The number of intra prediction modes which thecurrent block may have may be a fixed value and may be a valuedetermined differently according to an attribute of a prediction block.For example, an attribute of a prediction block may comprise a size of aprediction block and a shape of a prediction block, etc.

The number of intra-prediction modes may be fixed to N regardless of ablock size. Or, the number of intra prediction modes may be 3, 5, 9, 17,34, 35, 36, 65, or 67 etc. Alternatively, the number of intra-predictionmodes may vary according to a block size or a color component type orboth. For example, the number of intra prediction modes may varyaccording to whether the color component is a luma signal or a chromasignal. For example, as a block size becomes large, a number ofintra-prediction modes may increase. Alternatively, a number ofintra-prediction modes of a luma component block may be larger than anumber of intra-prediction modes of a chroma component block.

An intra-prediction mode may be a non-angular mode or an angular mode.The non-angular mode may be a DC mode or a planar mode, and the angularmode may be a prediction mode having a specific direction or angle. Theintra-prediction mode may be expressed by at least one of a mode number,a mode value, a mode numeral, a mode angle, and mode direction. A numberof intra-prediction modes may be M, which is larger than 1, includingthe non-angular and the angular mode. In order to intra-predict acurrent block, a step of determining whether or not samples included ina reconstructed neighbor block may be used as reference samples of thecurrent block may be performed. When a sample that is not usable as areference sample of the current block is present, a value obtained byduplicating or performing interpolation on at least one sample valueamong samples included in the reconstructed neighbor block or both maybe used to replace with a non-usable sample value of a sample, thus thereplaced sample value is used as a reference sample of the currentblock.

FIG. 7 is a diagram illustrating reference samples capable of being usedfor intra prediction.

As shown in FIG. 7, at least one of the reference sample line 0 to thereference sample line 3 may be used for intra prediction of the currentblock. In FIG. 7, the samples of a segment A and a segment F may bepadded with the samples closest to a segment B and a segment E,respectively, instead of retrieving from the reconstructed neighboringblock. Index information indicating the reference sample line to be usedfor intra prediction of the current block may be signaled. For example,in FIG. 7, reference sample line indicators 0, 1 and 2 may be signaledas index information indicating reference sample lines 0, 1 and 2. Whenthe upper boundary of the current block is the boundary of the CTU, onlythe reference sample line 0 may be available. Therefore, in this case,the index information may not be signaled. When a reference sample lineother than the reference sample line 0 is used, filtering for aprediction block, which will be described later, may not be performed.

When intra-predicting, a filter may be applied to at least one of areference sample and a prediction sample based on an intra-predictionmode and a current block size.

In case of a planar mode, when generating a prediction block of acurrent block, according to a position of a prediction target samplewithin a prediction block, a sample value of the prediction targetsample may be generated by using a weighted sum of an upper and leftside reference sample of a current sample, and a right upper side andleft lower side reference sample of the current block. In addition, incase of a DC mode, when generating a prediction block of a currentblock, an average value of upper side and left side reference samples ofthe current block may be used. In addition, in case of an angular mode,a prediction block may be generated by using an upper side, a left side,a right upper side, and/or a left lower side reference sample of thecurrent block. In order to generate a prediction sample value,interpolation of a real number unit may be performed.

In the case of intra prediction between color components, a predictionblock for the current block of the second color component may begenerated on the basis of the corresponding reconstructed block of thefirst color component. For example, the first color component may be aluma component, and the second color component may be a chromacomponent. For intra prediction between color components, the parametersof the linear model between the first color component and the secondcolor component may be derived on the basis of the template. Thetemplate may include upper and/or left neighboring samples of thecurrent block and upper and/or left neighboring samples of thereconstructed block of the first color component corresponding thereto.For example, the parameters of the linear model may be derived using asample value of a first color component having a maximum value amongsamples in a template and a sample value of a second color componentcorresponding thereto, and a sample value of a first color componenthaving a minimum value among samples in the template and a sample valueof a second color component corresponding thereto. When the parametersof the linear model are derived, a corresponding reconstructed block maybe applied to the linear model to generate a prediction block for thecurrent block. According to a video format, subsampling may be performedon the neighboring samples of the reconstructed block of the first colorcomponent and the corresponding reconstructed block. For example, whenone sample of the second color component corresponds to four samples ofthe first color component, four samples of the first color component maybe sub-sampled to compute one corresponding sample. In this case, theparameter derivation of the linear model and intra prediction betweencolor components may be performed on the basis of the correspondingsub-sampled samples. Whether or not to perform intra prediction betweencolor components and/or the range of the template may be signaled as theintra prediction mode.

The current block may be partitioned into two or four sub-blocks in thehorizontal or vertical direction. The partitioned sub-blocks may besequentially reconstructed. That is, the intra prediction may beperformed on the sub-block to generate the sub-prediction block. Inaddition, dequantization and/or inverse transform may be performed onthe sub-blocks to generate sub-residual blocks. A reconstructedsub-block may be generated by adding the sub-prediction block to thesub-residual block. The reconstructed sub-block may be used as areference sample for intra prediction of the sub-sub-blocks. Thesub-block may be a block including a predetermined number (for example,16) or more samples. Accordingly, for example, when the current block isan 8×4 block or a 4×8 block, the current block may be partitioned intotwo sub-blocks. Also, when the current block is a 4×4 block, the currentblock may not be partitioned into sub-blocks. When the current block hasother sizes, the current block may be partitioned into four sub-blocks.Information on whether or not to perform the intra prediction based onthe sub-blocks and/or the partitioning direction (horizontal orvertical) may be signaled. The intra prediction based on the sub-blocksmay be limited to be performed only when reference sample line 0 isused. When the intra prediction based on the sub-block is performed,filtering for the prediction block, which will be described later, maynot be performed.

The final prediction block may be generated by performing filtering onthe prediction block that is intra-predicted. The filtering may beperformed by applying predetermined weights to the filtering targetsample, the left reference sample, the upper reference sample, and/orthe upper left reference sample. The weight and/or the reference sample(range, position, etc.) used for the filtering may be determined on thebasis of at least one of a block size, an intra prediction mode, and aposition of the filtering target sample in the prediction block. Thefiltering may be performed only in the case of a predetermined intraprediction mode (e.g., DC, planar, vertical, horizontal, diagonal,and/or adjacent diagonal modes). The adjacent diagonal mode may be amode in which k is added to or subtracted from the diagonal mode. Forexample, k may be a positive integer of 8 or less.

An intra-prediction mode of a current block may be entropyencoded/decoded by predicting an intra-prediction mode of a blockpresent adjacent to the current block. When intra-prediction modes ofthe current block and the neighbor block are identical, information thatthe intra-prediction modes of the current block and the neighbor blockare identical may be signaled by using predetermined flag information.In addition, indicator information of an intra-prediction mode that isidentical to the intra-prediction mode of the current block amongintra-prediction modes of a plurality of neighbor blocks may besignaled. When intra-prediction modes of the current block and theneighbor block are different, intra-prediction mode information of thecurrent block may be entropy encoded/decoded by performing entropyencoding/decoding based on the intra-prediction mode of the neighborblock.

FIG. 5 is a diagram illustrating an embodiment of an inter-pictureprediction process.

In FIG. 5, a rectangle may represent a picture. In FIG. 5, an arrowrepresents a prediction direction. Pictures may be categorized intointra pictures (I pictures), predictive pictures (P pictures), andBi-predictive pictures (B pictures) according to the encoding typethereof.

The I picture may be encoded through intra-prediction without requiringinter-picture prediction. The P picture may be encoded throughinter-picture prediction by using a reference picture that is present inone direction (i.e., forward direction or backward direction) withrespect to a current block. The B picture may be encoded throughinter-picture prediction by using reference pictures that are preset intwo directions (i.e., forward direction and backward direction) withrespect to a current block. When the inter-picture prediction is used,the encoder may perform inter-picture prediction or motion compensationand the decoder may perform the corresponding motion compensation.

Hereinbelow, an embodiment of the inter-picture prediction will bedescribed in detail.

The inter-picture prediction or motion compensation may be performedusing a reference picture and motion information.

Motion information of a current block may be derived duringinter-picture prediction by each of the encoding apparatus 100 and thedecoding apparatus 200. The motion information of the current block maybe derived by using motion information of a reconstructed neighboringblock, motion information of a collocated block (also referred to as acol block or a co-located block), and/or a block adjacent to theco-located block. The co-located block may mean a block that is locatedspatially at the same position as the current block, within a previouslyreconstructed collocated picture (also referred to as a col picture or aco-located picture). The co-located picture may be one picture among oneor more reference pictures included in a reference picture list.

The derivation method of the motion information may be differentdepending on the prediction mode of the current block. For example, aprediction mode applied for inter prediction includes an AMVP mode, amerge mode, a skip mode, a merge mode with a motion vector difference, asubblock merge mode, a geometric partitioning mode, an inter-intracombination prediction mode, affine mode, and the like. Herein, themerge mode may be referred to as a motion merge mode.

For example, when the AMVP is used as the prediction mode, at least oneof motion vectors of the reconstructed neighboring blocks, motionvectors of the co-located blocks, motion vectors of blocks adjacent tothe co-located blocks, and a (0, 0) motion vector may be determined asmotion vector candidates for the current block, and a motion vectorcandidate list is generated by using the emotion vector candidates. Themotion vector candidate of the current block can be derived by using thegenerated motion vector candidate list. The motion information of thecurrent block may be determined based on the derived motion vectorcandidate. The motion vectors of the collocated blocks or the motionvectors of the blocks adjacent to the collocated blocks may be referredto as temporal motion vector candidates, and the motion vectors of thereconstructed neighboring blocks may be referred to as spatial motionvector candidates.

The encoding apparatus 100 may calculate a motion vector difference(MVD) between the motion vector of the current block and the motionvector candidate and may perform entropy encoding on the motion vectordifference (MVD). In addition, the encoding apparatus 100 may performentropy encoding on a motion vector candidate index and generate abitstream. The motion vector candidate index may indicate an optimummotion vector candidate among the motion vector candidates included inthe motion vector candidate list. The decoding apparatus may performentropy decoding on the motion vector candidate index included in thebitstream and may select a motion vector candidate of a decoding targetblock from among the motion vector candidates included in the motionvector candidate list by using the entropy-decoded motion vectorcandidate index. In addition, the decoding apparatus 200 may add theentropy-decoded MVD and the motion vector candidate extracted throughthe entropy decoding, thereby deriving the motion vector of the decodingtarget block.

Meanwhile, the coding apparatus 100 may perform entropy-coding onresolution information of the calculated MVD. The decoding apparatus 200may adjust the resolution of the entropy-decoded MVD using the MVDresolution information.

Meanwhile, the coding apparatus 100 calculates a motion vectordifference (MVD) between a motion vector and a motion vector candidatein the current block on the basis of an affine model, and performsentropy-coding on the MVD. The decoding apparatus 200 derives a motionvector on a per sub-block basis by deriving an affine control motionvector of a decoding target block through the sum of the entropy-decodedMVD and an affine control motion vector candidate.

The bitstream may include a reference picture index indicating areference picture. The reference picture index may be entropy-encoded bythe encoding apparatus 100 and then signaled as a bitstream to thedecoding apparatus 200. The decoding apparatus 200 may generate aprediction block of the decoding target block based on the derivedmotion vector and the reference picture index information.

Another example of the method of deriving the motion information of thecurrent may be the merge mode. The merge mode may mean a method ofmerging motion of a plurality of blocks. The merge mode may mean a modeof deriving the motion information of the current block from the motioninformation of the neighboring blocks. When the merge mode is applied,the merge candidate list may be generated using the motion informationof the reconstructed neighboring blocks and/or the motion information ofthe collocated blocks. The motion information may include at least oneof a motion vector, a reference picture index, and an inter-pictureprediction indicator. The prediction indicator may indicateone-direction prediction (L0 prediction or L1 prediction) ortwo-direction predictions (L0 prediction and L1 prediction).

The merge candidate list may be a list of motion information stored. Themotion information included in the merge candidate list may be at leastone of motion information (spatial merge candidate) of a neighboringblock adjacent to the current block, motion information (temporal mergecandidate) of the collocated block of the current block in the referencepicture, new motion information generated by a combination of the motioninformation exiting in the merge candidate list, motion information(history-based merge candidate) of the block that is encoded/decodedbefore the current block, and zero merge candidate.

The encoding apparatus 100 may generate a bitstream by performingentropy encoding on at least one of a merge flag and a merge index andmay signal the bitstream to the decoding apparatus 200. The merge flagmay be information indicating whether or not to perform the merge modefor each block, and the merge index may be information indicating thatwhich neighboring block, among the neighboring blocks of the currentblock, is a merge target block. For example, the neighboring blocks ofthe current block may include a left neighboring block on the left sideof the current block, an upper neighboring block disposed above thecurrent block, and a temporal neighboring block temporally adjacent tothe current block.

Meanwhile, the coding apparatus 100 performs entropy-coding on thecorrection information for correcting the motion vector among the motioninformation of the merge candidate and signals the same to the decodingapparatus 200. The decoding apparatus 200 can correct the motion vectorof the merge candidate selected by the merge index on the basis of thecorrection information. Here, the correction information may include atleast one of information on whether or not to perform the correction,correction direction information, and correction size information. Asdescribed above, the prediction mode that corrects the motion vector ofthe merge candidate on the basis of the signaled correction informationmay be referred to as a merge mode having the motion vector difference.

The skip mode may be a mode in which the motion information of theneighboring block is applied to the current block as it is. When theskip mode is applied, the encoding apparatus 100 may perform entropyencoding on information of the fact that the motion information of whichblock is to be used as the motion information of the current block togenerate a bit stream, and may signal the bitstream to the decodingapparatus 200. The encoding apparatus 100 may not signal a syntaxelement regarding at least any one of the motion vector differenceinformation, the encoding block flag, and the transform coefficientlevel to the decoding apparatus 200.

The subblock merge mode may mean a mode that derives the motioninformation in units of sub-blocks of a coding block (CU). When thesubblock merge mode is applied, a subblock merge candidate list may begenerated using motion information (sub-block based temporal mergecandidate) of the sub-block collocated to the current sub-block in thereference image and/or an affine control point motion vector mergecandidate.

The geometric partitioning mode may mean a mode that derives motioninformation by partitioning the current block into the pre-defineddirections, derives each prediction sample using each of the derivedmotion information, and derives the prediction sample of the currentblock by weighting each of the derived prediction samples.

The inter-intra combined prediction mode may mean a mode that derives aprediction sample of the current block by weighting a prediction samplegenerated by inter prediction and a prediction sample generated by intraprediction.

The decoding apparatus 200 may correct the derived motion information byitself. The decoding apparatus 200 may search the predetermined regionon the basis of the reference block indicated by the derived motioninformation and derive the motion information having the minimum SAD asthe corrected motion information.

The decoding apparatus 200 may compensate a prediction sample derivedvia inter prediction using an optical flow.

FIG. 6 is a diagram illustrating a transform and quantization process.

As illustrated in FIG. 6, a transform and/or quantization process isperformed on a residual signal to generate a quantized level signal. Theresidual signal is a difference between an original block and aprediction block (i.e., an intra prediction block or an inter predictionblock). The prediction block is a block generated through intraprediction or inter prediction. The transform may be a primarytransform, a secondary transform, or both. The primary transform of theresidual signal results in transform coefficients, and the secondarytransform of the transform coefficients results in secondary transformcoefficients.

At least one scheme selected from among various transform schemes whichare preliminarily defined is used to perform the primary transform. Forexample, examples of the predefined transform schemes include discretecosine transform (DCT), discrete sine transform (DST), andKarhunen-Loeve transform (KLT). The transform coefficients generatedthrough the primary transform may undergo the secondary transform. Thetransform schemes used for the primary transform and/or the secondarytransform may be determined according to coding parameters of thecurrent block and/or neighboring blocks of the current block.Alternatively, transform information indicating the transform scheme maybe signaled. The DCT-based transform may include, for example, DCT-2,DCT-8, and the like. The DST-based transform may include, for example,DST-7.

A quantized-level signal (quantization coefficients) may be generated byperforming quantization on the residual signal or a result of performingthe primary transform and/or the secondary transform. The quantizedlevel signal may be scanned according to at least one of a diagonalup-right scan, a vertical scan, and a horizontal scan, depending on anintra prediction mode of a block or a block size/shape. For example, asthe coefficients are scanned in a diagonal up-right scan, thecoefficients in a block form change into a one-dimensional vector form.Aside from the diagonal up-right scan, the horizontal scan ofhorizontally scanning a two-dimensional block form of coefficients orthe vertical scan of vertically scanning a two-dimensional block form ofcoefficients may be used depending on the intra prediction mode and/orthe size of a transform block. The scanned quantized-level coefficientsmay be entropy-encoded to be inserted into a bitstream.

A decoder entropy-decodes the bitstream to obtain the quantized-levelcoefficients. The quantized-level coefficients may be arranged in atwo-dimensional block form through inverse scanning. For the inversescanning, at least one of a diagonal up-right scan, a vertical scan, anda horizontal scan may be used.

The quantized-level coefficients may then be dequantized, then besecondary-inverse-transformed as necessary, and finally beprimary-inverse-transformed as necessary to generate a reconstructedresidual signal.

Inverse mapping in a dynamic range may be performed for a luma componentreconstructed through intra prediction or inter prediction beforein-loop filtering. The dynamic range may be divided into 16 equal piecesand the mapping function for each piece may be signaled. The mappingfunction may be signaled at a slice level or a tile group level. Aninverse mapping function for performing the inverse mapping may bederived on the basis of the mapping function. In-loop filtering,reference picture storage, and motion compensation are performed in aninverse mapped region, and a prediction block generated through interprediction is converted into a mapped region via mapping using themapping function, and then used for generating the reconstructed block.However, since the intra prediction is performed in the mapped region,the prediction block generated via the intra prediction may be used forgenerating the reconstructed block without mapping/inverse mapping.

When the current block is a residual block of a chroma component, theresidual block may be converted into an inverse mapped region byperforming scaling on the chroma component of the mapped region. Theavailability of the scaling may be signaled at the slice level or thetile group level. The scaling may be applied only when the mapping forthe luma component is available and the division of the luma componentand the division of the chroma component follow the same tree structure.The scaling may be performed on the basis of an average of sample valuesof a luma prediction block corresponding to the color difference block.In this case, when the current block uses inter prediction, the lumaprediction block may mean a mapped luma prediction block. A valuenecessary for the scaling may be derived by referring to a lookup tableusing an index of a piece to which an average of sample values of a lumaprediction block belongs. Finally, by scaling the residual block usingthe derived value, the residual block may be switched to the inversemapped region. Then, chroma component block restoration, intraprediction, inter prediction, in-loop filtering, and reference picturestorage may be performed in the inverse mapped area.

Information indicating whether the mapping/inverse mapping of the lumacomponent and chroma component is available may be signaled through aset of sequence parameters.

The prediction block of the current block may be generated on the basisof a block vector indicating a displacement between the current blockand the reference block in the current picture. In this way, aprediction mode for generating a prediction block with reference to thecurrent picture is referred to as an intra block copy (IBC) mode. TheIBC mode may be applied to M×N (M<=64, NC=64) coding units. The IBC modemay include a skip mode, a merge mode, an AMVP mode, and the like. Inthe case of a skip mode or a merge mode, a merge candidate list isconstructed, and the merge index is signaled so that one merge candidatemay be specified. The block vector of the specified merge candidate maybe used as a block vector of the current block. The merge candidate listmay include at least one of a spatial candidate, a history-basedcandidate, a candidate based on an average of two candidates, and azero-merge candidate. In the case of an AMVP mode, the difference blockvector may be signaled. In addition, the prediction block vector may bederived from the left neighboring block and the upper neighboring blockof the current block. The index on which neighboring block to use may besignaled. The prediction block in the IBC mode is included in thecurrent CTU or the left CTU and limited to a block in the alreadyreconstructed area. For example, a value of the block vector may belimited such that the prediction block of the current block ispositioned in an area of three 64×64 blocks preceding the 64×64 block towhich the current block belongs in the coding/decoding order. Bylimiting the value of the block vector in this way, memory consumptionand device complexity according to the IBC mode implementation may bereduced.

In the present invention, encoding/decoding may mean entropyencoding/decoding.

Hereinafter, with reference to FIG. 8 to FIG. 15, an imageencoding/decoding method according to one embodiment of the presentinvention is described.

According to the present invention, image encoding/decoding throughintra prediction may be performed by deriving an intra-prediction mode,constructing a reference sample and/or performing intra prediction.

When image encoding/decoding through intra prediction is performed, thestep of deriving an intra-prediction mode of a current block may beperformed.

Herein, the intra-prediction mode of a current block may be derived byusing at least one among an intra-prediction mode of a neighboringblock, entropy encoding/decoding of the intra-prediction mode of acurrent block from a bitstream, a coding parameter of a neighboringblock and/or an intra-prediction mode of a color component.

In addition, an intra-prediction mode of a current block or a sub-blockmay be determined based on at least one among a reference sample lineindicator (intra_luma_ref_idx), a block partition indicator(intra_subblock_flag), a block partition direction indicator(intra_subblock_type_flag) and CIIP (Combined Inter and IntraPrediction) mode indicator. Here, a block partition indicator(intra_subblock_flag) may be used in the same meaning as a partitionsplit indicator (intra_subpartitions_mode_flag). In addition, a blockpartition direction indicator (intra_subblock_type_flag) may be used inthe same meaning as a partition split direction indicator(intra_subpartitions_split_flag).

A block partition indicator may indicate whether or not a current blockthat is intra predicted is partitioned. In addition, a block partitiondirection indicator may indicate whether the partition direction of acurrent block that is intra predicted is the horizontal direction or thevertical direction. A block partition direction indicator may besignaled when a block partition indicator indicates “partition”. When ablock partition indicator indicates “partition”, a current block may bepartitioned into two or four sub-blocks. For example, when the size of acurrent block is 4×8 or 8×4, the current block may be partitioned intotwo sub-blocks. When the size of a current block is 8×8 or more, thecurrent block may be partitioned into four sub-blocks. Here, asdescribed above, the direction of partition may be derived by a blockpartition direction indicator. Each of partitioned sub-blocks may besequentially encoded and decoded according to a predetermined order. Thepredetermined order may proceed from top to bottom for horizontaldirection partition and from left to right for vertical directionpartition. At least one sample included in a reconstructed sub-block maybe used as a reference sample of a sub-block of the next order. Anintra-prediction mode for a current block may be commonly used asintra-prediction mode for each sub-block.

According to one embodiment of the present invention, at least one ormore reconstructed neighboring blocks may be used to derive anintra-prediction mode of a current block. Here, a neighboring block maybe used in the same meaning as adjacent block.

The position of a reconstructed neighboring block may be a predeterminedand fixed one or may be determined through encoding/decoding. Forexample, if the coordinate of the upper left corner sample of a currentblock with the size of W×H is (0, 0), the neighboring block may be atleast one among blocks adjacent to coordinates (−1, H−1), (W−1, −1), (W,−1), (−1, H) and (−1, −1) and neighboring blocks of the blocks. Here, Wand H may indicate the horizontal length (=width) and vertical length(=height) of a current block or the number of samples.

When an intra-prediction mode of a current block is derived by using anintra-prediction mode of a neighboring block, an intra-prediction modeof an unavailable neighboring block may be replaced by a predeterminedintra-prediction mode. Here, the predetermined intra-prediction mode maybe at least one among a DC mode, a PLANAR mode, a vertical mode, ahorizontal mode and/or a diagonal mode.

For example, when a neighboring block is positioned outside the boundaryof at least one unit among picture, slice, tile and CTU (Coding TreeUnit), when a neighboring block is intra predicted, and when aneighboring block is coded into IBC mode, MIP mode or PCM mode, thecorresponding neighboring block may be judged as unavailable. However,when a neighboring block is intra predicted and an indicator showingwhether or not inter prediction and intra prediction are combined (forexample, inter_intra_flag) is ‘1’ (or ‘True’), the correspondingneighboring block may be judged as available.

In addition, an intra-prediction mode of a current block may be derivedas a statistical value of an intra-prediction mode of two or moreneighboring blocks. Herein, a statistical value may be at least oneamong an average value, a maximum value, a minimum value, a mostfrequent value, a median value, a weighted average value, and aninterpolated value.

In addition, an intra-prediction mode of a current block may be derivedbased on sizes of neighboring blocks. For example, an intra-predictionmode of a relatively large neighboring block may be derived as theintra-prediction mode of a current block. Alternatively, when anintra-prediction mode of a current block is derived from a statisticalvalue of an intra-prediction mode of a neighboring block, a large weightmay be given to an intra-prediction mode of a relatively largeneighboring block.

In addition, when an intra-prediction mode of a current block isderived, it may be considered whether an intra-prediction mode of aneighboring block is directional or not. For example, anintra-prediction mode of a neighboring block is non-directional (forexample, DC, PLANAR, etc.), the corresponding non-directional mode maybe derived as an intra-prediction mode of a current block.Alternatively, on the contrary, an intra-prediction mode of a currentblock may be derived by using intra-prediction modes of otherneighboring blocks than a neighboring block with the correspondingnon-directional mode.

In order to derive an intra-prediction mode of a current block, one ormore MPM (Most Probable Mode) lists may be constructed by using anintra-prediction mode of a neighboring block. The number N of candidatemodes included in an MPM list may have a fixed value or be determinedaccording to the size and/or shape of a current block. In addition, anMPM list may be constructed so that there is no duplicate mode.

Herein, when the number of available candidate modes is less than N, apredetermined candidate mode among available candidate modes may beadded to an MPM list. For example, a mode that is obtained by adjustinga predetermined offset to a directional mode may be added to an MPMlist. Here, the predetermined offset may be a positive integer (forexample, 1, 2, 3, 4, etc.). Alternatively, at least one among ahorizontal mode, a vertical mode, a 45-degree mode, a 135-degree mode, a225-degree mode and a non-directional mode may be added to an MPM list.

Based on the position of a neighboring block, an MPM list may beconstructed according to a predetermined order. For example, an MPM listmay be constructed in the order of blocks that are adjacent to the left,top, bottom left corner, top right corner and top left corner of acurrent block. Here, a non-directional mode may be included in anarbitrary position of MPM list. For example, a non-directional mode maybe added next to the intra-prediction modes of blocks adjacent to theleft and top of a current block.

Alternatively, when an MPM list is constructed, a non-directional mode(for example, DC mode, PLANAR mode and the like) may be always added. Anon-directional mode may have a high probability of occurrence, sinceprediction is performed by using both top and left reference samples.Accordingly, as DC mode and PLANAR mode are always added to an MPM list,a bit overhead for signaling an intra-prediction mode may be reduced.

According to an embodiment of the present invention, an intra-predictionmode of a current block may be derived by using an intra-predictionmode, which is derived by using an MPM list, and an intra-predictionmode of a neighboring block.

For example, when an intra-prediction mode that is derived by using anMPM list is Pred_mpm, Pred_mpm may be changed by using anintra-prediction mode of a neighboring block. Herein, if Pred_mpm islarger than an intra-prediction mode of a neighboring block or astatistical value of two or more intra-prediction modes, Pred_mpm mayincrease by n. Alternatively, if Pred_mpm is smaller than anintra-prediction mode of a neighboring block or a statistical value oftwo or more intra-prediction modes, Pred_mpm may decrease by n. Here, nmay be a predetermined integer (for example, 1, 2, 3, 0, −1, −2, −3,etc.). An intra-prediction mode of a current block may be derived as achanged Pred_mpm.

In addition, when at least one of Pred_mpm and an intra-prediction modeof a neighboring block is a non-directional mode (for example, DC mode,PLANAR mode, etc.), an intra-prediction mode of a current block may bederived as the non-directional mode. Alternatively, on the contrary, anintra-prediction mode of a current block may be derived as a directionalmode.

According to an embodiment of the present invention, an intra-predictionmode of a different color component may be used to derive anintra-prediction mode of a current block.

For example, when a current block is a chroma block, an intra-predictionmode of a luma block corresponding to the chroma block may be used.Herein, there may be one or more corresponding luma blocks, and thenumber of corresponding luma blocks may be determined based on at leastone among the size and shape of a chroma block and/or a codingparameter. Alternatively, a corresponding luma block may be determinedbased on at least one among the size and shape of a luma block and/or acoding parameter.

A luma block corresponding to a chroma block may include a multiplicityof partitions. All or part of multiple partitions may have differentintra-prediction modes.

An intra-prediction mode of a chroma block may be derived based on allor part of multiple partitions within a corresponding luma block.Herein, some partitions may be selectively used through comparison ofthe size, shape, depth and other information between a chroma block anda luma block (all or some of multiple partitions).

In addition, a partition at a position within a luma block correspondingto a predetermined position of a chroma block may be selectively used.In this case, a predetermined position may mean the position of acentral sample or a corner sample (for example, a top-left sample) of achroma block.

A method of deriving an intra-prediction mode between color componentsaccording to an embodiment of the present invention is not limited tousing an intra-prediction mode of a corresponding luma block. Forexample, an intra-prediction mode of a chroma block may be derived byusing at least one among the mpm_idx of a corresponding luma block or anMPM list. In addition, an intra-prediction mode of a chroma block may bederived by sharing at least one among the mpm_idx of a correspondingluma block or an MPM list.

FIG. 8 is a view for explaining the relationship between a luma blockand a chroma block.

Referring to FIG. 8, a ratio among color components may be 4:2:0, and aluma block corresponding to a chroma block may be at least one or moreamong A, B, C and D.

An intra-prediction mode of a chroma block may be derived by using anintra-prediction mode of the luma block A corresponding to the top-leftposition (0, 0) within the chroma block or an intra-prediction mode ofthe luma block D corresponding to the position of central sample (nS/2,nS/2) of the chroma block. Here, a predetermined position within achroma block is not limited to (0.0) and (nS/2, nS/2) and may be theposition of top-right, bottom-left and/or bottom-right sample within thechroma block.

A predetermined position within a chroma block may be determined basedon the shape of the chroma block. For example, when the shape of achroma block is square, a predetermined position within the chroma blockmay be the position of a central sample. In addition, when the shape ofa chroma block is rectangular, a predetermined position within thechroma block may be the position of a top-left sample. Alternatively, inthe above example, a predetermined position within a square chroma blockand a predetermined position within a rectangular chroma block may beopposite to each other.

In addition, an intra-prediction mode of a chroma block may be derivedby using a statistical value of one or more intra-prediction modeswithin a luma block corresponding to the size of the chroma block.Herein, a statistical value may be at least one among an average value,a maximum value, a minimum value, a most frequent value, a median value,a weighted average value, and an interpolated value.

For example, referring to FIG. 8, a mode corresponding to the average ofthe intra-prediction modes of the luma blocks A and D or a modecorresponding to the average of the intra-prediction modes of the lumablocks A, B, C and D corresponding to the size of a chroma block may bederived as the intra-prediction mode of the chroma block.

When there is a multiplicity of intra-prediction modes of an availableluma block, all or some of the intra-prediction modes may be selected.Here, all or some of the intra-prediction modes of a luma block may beselected based on a predetermined position within a chroma block orbased on the size, shape and/or depth of a chroma block and/or a lumablock. By using an intra-prediction mode of a luma block thus selected,an intra-prediction mode of a chroma block may be derived.

For example, the size of luma block A corresponding to the position (0,0) of the top-left sample within a chroma block may be compared with thesize of luma block D corresponding to the position (nS/2, nS/2) of thecentral sample within the chroma block. As a result, an intra-predictionmode of the chroma block may be derived by using an intra-predictionmode of the luma block D that is relatively large.

In addition, when the size of a luma block corresponding to apredetermined position within a chroma block is equal to or larger thanthe size of the chroma block, an intra-prediction mode of the chromablock may be derived by using an intra-prediction mode of thecorresponding luma block.

In addition, when the size of a chroma block is within a predeterminedrange, an intra-prediction mode of the chroma block may be derived byusing an intra-prediction mode of a luma block corresponding to theposition (0, 0) of the top-left sample within the chroma block.

Here, the predetermined range may be derived based on at least one pieceof information among information signaled through a bitstream, the sizeof a chroma block and/or a luma block, the depth of a chroma blockand/or a luma block, and information predefined in an encoder/decoder.

In addition, among multiple partitions within a luma block, a partitionwith the same shape as a chroma block is used to derive anintra-prediction mode of the chroma block. For example, when the shapeof a chroma block is square or rectangular, an intra-prediction mode ofthe chroma block may be derived by using a square or non-squarepartition among multiple partitions within a luma block.

In the above description concerning FIG. 8, deriving an intra-predictionmode of a chroma block by using an intra-prediction mode of a luma blockmay include a case where the intra-prediction mode of the luma block isused as the intra-prediction mode of the chroma block as it is.

In addition, apart from the case where an intra-prediction mode of aluma block is used as an intra-prediction mode of a chroma block as itis, a case may be included where information (for example, mpm_idx, MPLlist, etc.) used to derive an intra-prediction mode of a luma block isused to derive an intra-prediction mode of a chroma block.

In addition, an intra-prediction mode of a luma block corresponding to apredetermined position within a chroma block may be used to derive anMPM list for the chroma block. Here, information (for example, mpm_idx)for a chroma block may be encoded and signaled. An MPM list for a chromablock may be constructed in a similar way to an MPM list for a lumablock. Alternatively, an MPM candidate of a chroma block may include atleast one among an intra-prediction mode of a neighboring chroma blockand/or an intra-prediction mode of the corresponding luma block.

When an MPM list for a chroma block is constructed, if an indicator (forexample, MPM flag) indicating whether or not an intra-prediction mode ofa current block is included in an MPM list is “0”, a second MPM listincluding one or more intra-prediction modes may be constructed. Inaddition, a second MPM index (for example, 2nd_mpm_idx) may be used toderive an intra-prediction mode of a current block. Here, a secondindicator (for example, 2nd MPM flag) indicating whether or not anintra-prediction mode of a current block is included in a second MPMlist may be encoded/decoded. Similar to a first MPM list, a second MPMlist may be constructed by using the intra-prediction modes of aneighboring block. Herein, an intra-prediction mode included in a firstMPM list may not be included in a second MPM list. The number of MPMlists used for deriving an intra-prediction mode of a current block isnot limited to 1 or 2, but N MPM lists may be used (Here, N is apositive integer).

For another example, two MPM lists may be constructed, and information(for example, mpm_flag) indicating whether or not an intra-predictionmode of a current block is included in the two MPM lists may besignaled. When an intra-prediction mode of a current block is includedin at least one of two MPM lists, information (for example,first_mpm_flag) indicating whether or not the intra-prediction mode ofthe current block is included in the first MPM list may be signaled.

For example, when first_mpm_flag has a first value (for example, 1), itmay indicate that an intra-prediction mode of a current block isincluded in a first MPM list. When first_mpm_flag has a first value,based on index information for a first MPM list, an intra-predictionmode of a current block may be determined as one of the MPM candidatesincluded in the first MPM list. When a first MPM list includes only oneMPM candidate, separate index information may not be signaled. In thiscase, if first_mpm_flag has a first value, an intra-prediction mode of acurrent block may be determined as the one MPM candidate included in afirst MPM list.

For example, when first_mpm_flag has a second value (for example, 0), itmay indicate that an intra-prediction mode of a current block is notincluded in a first MPM list. When first_mpm_flag has a second value, anintra-prediction mode of a current block may be determined to beincluded in a second MPM list. Accordingly, in this case, indexinformation indicating one of the modes included in a second MPM listmay be signaled. An intra-prediction mode of a current block may bedetermined as one MPM candidate specified by the index information amongMPM candidates included in a second MPM list.

When an intra-prediction mode of a current block is not included in oneof multiple MPM lists, an intra-prediction mode of a luma component of acurrent block may be encoded/decoded. In addition, an intra-predictionmode of a chroma component may be encoded/decoded or derived based on anintra-prediction mode of the corresponding luma component.

When a current block is partitioned into sub-blocks, intra-predictionmodes for each sub-block thus obtained may be derived based on at leastone among the above-described methods. Alternatively, as describedabove, an intra-prediction mode derived for a current block may beuniformly used for each of sub-blocks.

The size and/or shape of a sub-block may be a predetermined size (forexample, 4×4) and/or shape. Alternatively, the size and/or shape of asub-block may be determined based on the size and/or shape of a currentblock.

In addition, the size of a sub-block may be determined based on whetheror not a neighboring block of a current block is partitioned or based onan intra-prediction mode of a neighboring block of a current block. Forexample, the size of a sub-block may be determined by partitioning acurrent block based on a boundary where neighboring blocks havedifferent intra-prediction modes. Alternatively, the size of a sub-blockmay be determined as a current block is partitioned based on whether aneighboring block is a coding block of intra prediction or interprediction.

Whether or not the size of a current block is a predetermined size maybe judged based on the horizontal length or vertical length of a currentblock. For example, if a horizontal length or a vertical length is alength that can be partitioned, it may be judged that the size of acurrent block is a predetermined size.

When a current block is partitioned into a multiplicity of sub-blocks,intra-prediction modes of the multiplicity of sub-blocks may be derivedin a zigzag order or in parallel. An intra-prediction mode of asub-block may be derived through at least one or more methods ofderiving an intra-prediction mode of a current block. Here, aneighboring block of a current block may be used as a neighboring blockof each sub-block. In addition, a sub-block within a current block maybe used as a neighboring block of each sub-block.

An intra-prediction mode of a sub-block within a current block may bederived by using an intra-prediction mode of a current block and anaverage value of the intra-prediction modes of blocks adjacent to theleft and top of a sample at the position (0. 0) of each sub-block. Forexample, when an intra-prediction mode of a current block is larger thanan average value of the intra-prediction modes of blocks adjacent to theleft and top of a sample at the position (0, 0) of each sub-block, thederived intra-prediction mode may decrease by one-half of the averagevalue. Otherwise, that is, an intra-prediction mode of a current blockis equal to or smaller than an average value of the intra-predictionmodes of blocks adjacent to the left and top of a sample at the position(0, 0) of each sub-block, the derived intra-prediction mode mayincrease.

Information on intra prediction may be signaled through at least oneamong VPS (Video Parameter Set), SPS(Sequence Parameter Set), PPS(Picture Parameter Set), APS (Adaptation Parameter Set), slice headerand tile header. Here, for a predetermined block size or below, at leastone or more pieces of information on intra prediction may not besignaled. When at least one or more pieces of information on intraprediction are not signaled, information on the intra prediction of ablock (for example, an upper block), which is encoded/decoded before acurrent block is encoded/decoded, may be used.

When image encoding/decoding through intra prediction is performed, anintra-prediction mode may be derived as a current block is partitionedinto predetermined sub-blocks, and intra prediction may be performed.Herein, a current block may be partitioned into sub-blocks based on atleast one among the size/shape of the current block and the size/shapeof a sub-block.

FIG. 9 is a view for explaining an embodiment where a current block ispartitioned into sub-blocks.

The horizontal or vertical size of a current block may be divided into Kequal parts, thereby being partitioned into sub-blocks. Here, K may bean integer that is equal to or greater than 1.

For example, referring to FIG. 9, when a current block has the size ofM×N and is partitioned into four equal parts, the size of a sub-blockmay be (M/4)×N or M×(N/4) Accordingly, for example, when the size of acurrent block is 32×16, the current block may be partitioned into foursub-blocks, each of which has a size of 8×16 or 32×4.

FIG. 10 is a view for explaining an embodiment where a current block ispartitioned into sub-blocks.

When the horizontal size or vertical size of a current block is within apredetermined range, the current block may be partitioned into K equalparts. Otherwise, the current block may be partitioned into L equalparts. Here, L and K are different, and both may be an integer that isequal to or greater than 2.

For example, when a horizontal size or a vertical size is equal to orgreater than 16, a current block may be partitioned into four equalparts. When a horizontal size or a vertical size is 8, a current blockmay be partitioned into two equal parts. In addition, when a horizontalsize or a vertical size is less than 8, partitioning may not beperformed.

As illustrated in FIG. 10, when the size of a current block is 16×8, thevertical size is 8 and thus the current block may be partitioned intotwo equal parts. In addition, since the horizontal size is 16, thecurrent block may be partitioned into four equal parts. In other words,the current block with the size of 16×8 may be partitioned into two 16×4sub-blocks or four 4×8 sub-blocks.

Alternatively, as described above, when a current block is a 4×8 blockor an 8×4 block, it may be partitioned into two equal parts. When acurrent block is an 8×8 or greater block, it may be partitioned intofour equal parts.

When a current block is partitioned into sub-blocks, information onpartition type may be signaled. Information on partition type mayinclude at least one of a block partition indicator (for example,intra_subblock_flag, intra_subpartitions_mode_flag, etc.) and a blockpartition direction indicator (for example, intra_subblock_type_flag,intra_subpartitions_split_flag, etc.). Herein, a block partitiondirection indicator may indicate whether a current block is to bepartitioned in the vertical direction (for example, the horizontal sizeof the current block is partitioned into K equal parts) or in thehorizontal direction (for example, the vertical size of the currentblock is partitioned into K equal parts).

When the horizontal size or vertical size of a current block is apredetermined size, a block partition indicator may be signaled. Forexample, when the horizontal size or vertical size of a current block isequal to or smaller than a maximum transform size, a block partitionindicator may be signaled. The maximum transform size may be 64.

In addition, when the horizontal size or vertical size of a currentblock is larger than a predetermined size, a block partition indicatormay be signaled. For example, the product of the horizontal size and thevertical size of a current block is larger than the square of a minimumtransform size, a block partition indicator may be signaled. Forexample, the minimum transform size may be 4. When the product of thehorizontal size and the vertical size of a current block is greater than16 (=4×4), a block partition indicator may be signaled.

When the horizontal size or vertical size of a current block is apredetermined size, a block partition direction indicator may besignaled. For example, when both the horizontal size and the verticalsize of a current block are larger than a minimum transform size (forexample, 4), a block partition direction indicator may be signaled.

Meanwhile, when one of the horizontal size and the vertical size of acurrent block is a minimum transform size (for example, 4×N or N×4), apartition direction may be inferred with no block partition directionindicator being signaled. For example, when a horizontal size is aminimum transform size, a partition direction may be inferred in thehorizontal direction. In addition, when a vertical size is a minimumtransform size, a partition direction may be inferred in the verticaldirection. For example, when the size of a current block is 4×16, apartition direction is inferred in the horizontal direction and thus thecurrent block may be partitioned into four sub-blocks, each of which hasa size of 4×4. Alternatively, when the size of a current block is 8×4, apartition direction is inferred in the vertical direction and thus thecurrent block may be partitioned into two sub-blocks, each of which hasa size of 4×4.

FIG. 11 is a view for explaining an intra-prediction mode of aneighboring block, which is used to derive an intra-prediction mode of acurrent block, according to an embodiment of the present invention.

When an intra-prediction mode of a current block is derived, an MPM maybe derived by using an intra-prediction mode of a neighboring block.

For example, referring to FIG. 11, an MPM may be derived by using theintra-prediction mode A of a neighboring block adjacent to the left of acurrent block and the intra-prediction mode B of a neighboring blockadjacent to the top of a current block. Here, an MPM may be derived byusing a statistical value of A and B (for example, at least one among anaverage value, a maximum value, a minimum value, a most frequent value,a median value, a weighted average value, and an interpolated value).

In addition, an MPM may be derived by adding or subtracting apredetermined offset (for example, 1, 2, 3, . . . ) to or from A, B or astatistical value of A and B.

In addition, an MPM may be derived by applying modular calculation (M)and/or offset to A, B or a statistical value of A and B.

FIG. 12 is a view illustrating an example of intra-prediction modeaccording to an embodiment of the present invention.

In FIG. 12, the direction of a dotted line shows a wide angle mode thatis applied only to a non-square block. As shown in FIG. 12, anintra-prediction mode may include 93 directional modes together with 2non-directional modes. Non-directional modes may include a planar modeand a DC mode. As illustrated by arrows in FIG. 12, directional modesmay include modes from No. 2 to No. 80 and No. −1 to No. −14.

When an intra-prediction mode of a current block is derived, an MPM oran intra-prediction mode may be derived based on at least one among areference sample line indicator (for example, intra_luma_ref_idx), ablock partition indicator (for example, intra_subblock_flag,intra_subpartitions_mode_flag, etc.), a block partition directionindicator (for example, intra_subblock_type_flag,intra_subpartitions_split_flag, etc.) and an indicator showing whetheror not inter prediction and intra prediction are combined (for example,inter_intra_flag, ciip_flag).

FIG. 13 is a view for explaining a process of deriving an MPM accordingto an embodiment of the present invention.

Referring to FIG. 13, an MPM list for a current block may be constructedbased on the intra-prediction mode A of a neighboring block adjacent tothe left of a current block and the intra-prediction mode B of aneighboring block adjacent to the top of a current block.

When A and B are the same mode and a directional mode (for example, amode greater than 1) (S1301—‘true’), a list including six MPM candidatesin the order of Planar, DC, A, 2+((A+61)%64), 2+((A−61)%64) and2+((A+60)%64) may be constructed (S1305).

When A and B are different modes and both are directional modes(S1302—‘true’), an MPM list including four MPM candidates in the orderof Planar, DC, A and B may be constructed (S1306). In addition, thelarger mode of A and B and the smaller mode of A and B may be determinedas maxAB and minAB respectively. Here, if a difference between maxAB andminAB is greater than 1 but less than 63 (S1303—‘true’), two MPMcandidates may be added to the MPM list in the order of2+((maxAB+61)%64) and 2+((maxAB−1) %64) (S1307). In addition, if adifference between maxAB and minAB is 1 or equal to or greater than 63(S1303—‘false’), two MPM candidates may be added to the MPM list in theorder of 2+((maxAB+60)%64) and 2+((maxAB) %64) (S1308).

When A and B are different modes, one is a directional mode and theother is a non-directional mode (S1304—‘true’), an MPM list includingsix MPM candidates in the order of Planar, DC, maxAB, 2+((maxAB+61)%64),2+((maxAB−1)%64) and 2+((maxAB+60)%64) may be constructed (S1309).

In other cases than the above-described cases (S1304—‘false’), forexample, when A and B are the same and a non-directional mode (forexample, a mode that is equal to or less than 1), or when A and B aredifferent but both are non-directional modes, an MPM list including sixMPM candidates in the order of Planar, DC, 50, 18, 2 and 34 may beconstructed (S1310).

An MPM list for a current block may be differently constructed based ona reference sample line indicator (intra_luma_ref_idx) for the currentblock. For example, when a reference sample line indicator for a currentblock is ‘0’ and when it is not ‘0’, an MPM list may be differentlyconstructed. Specifically, when a reference sample line indicator is 0,an MPM list may be constructed according to the conventional methoddescribed above. When a reference sample line indicator is not 0, anon-directional mode may not be used as an MPM candidate. For example,when a reference sample line indicator is not 0, a planar mode cannot beused as an MPM candidate. Alternatively, a planar or DC mode, which is anon-directional mode, may be excluded from a constructed MPM list.Accordingly, when a reference sample line indicator is not 0, onedirectional mode among modes in an MPM list may be derived as anintra-prediction mode of a current block.

Alternatively, as described above, when an MPM list of a current blockis constructed as a first MPM list and a second MPM list and the firstMPM list is constructed by including only one non-directional mode (forexample, planar mode), whether or not the first MPM list is availablemay be differently determined based on a value of a reference sampleline indicator. For example, when the value of a reference sample lineindicator is 0, it may be determined that a first MPM list is available.In addition, when the value of a reference sample line indicator is 1,it may be determined that a first MPM list is not available. Inaddition, in this case, a second MPM list may be determined irrespectiveof the value of a reference sample line indicator.

For example, in an MPM list derived through the process of FIG. 13, anintra-prediction mode of a current block may be derived by using onlyfour MPMs excluding Planar and/or DC, which is a non-directional modecorresponding to index 0 and 1. As a variant example, irrespective of avalue of a reference sample line indicator, a Planar mode that is anon-directional mode may be excluded from an MPM list derived throughthe process of FIG. 13. In other words, an intra-prediction mode of acurrent block may be derived by using an MPM list constructing five MPMsincluding DC mode.

In addition, when a sub-block partition prediction for a current blockis performed, an MPM list may be constructed excluding DC mode.Alternatively, DC mode may be excluded from a constructed MPM list.

For example, when a block partition indicator(intra_subpartitions_mode_flag) indicating whether or not a currentblock is partitioned into sub-blocks is ‘1’ (or ‘true’), anon-directional mode (Planar mode and/or DC mode) may be excluded from aconstructed MPM list.

As a variant example, when a sub-block partition prediction for acurrent block is performed, an MPM list may be constructed excludingPlanar mode. Alternatively, Planar mode may be excluded from aconstructed MPM list.

For example, when a block partition indicator(intra_subpartitions_mode_flag) indicating whether or not a currentblock is partitioned into sub-blocks is ‘1’ (or ‘true’), a Planar modemay be excluded from a constructed MPM list. In other words, a DC modemay be included in an MPM list, irrespective of whether or not asub-block partition prediction is performed for a current block.

For example, in an MPM list derived through the process of FIG. 13, anintra-prediction mode of a current block may be derived by using onlyfive MPMs excluding DC mode that corresponds to index 1.

Alternatively, as described above, when an MPM list of a current blockis constructed as a first MPM list and a second MPM list and the firstMPM list is constructed by including only one non-directional mode (forexample, planar mode), the second MPM list may be determinedirrespective of a value of a block partition indicator.

According to another embodiment of the present invention, when an MPMlist of a current block consists of a first MPM list and a second MPMlist and the first MPM list is constructed by including only onenon-directional mode (for example, planar mode), the second MPM list maybe determined independently of a value of a reference sample lineindicator and/or a value of a block partition indicator.

In addition, when the combined inter and intra prediction for a currentblock is performed, an MPM is not derived and intra prediction may beperformed by using a planar mode.

For example, when a CIIP mode indicator is ‘1’ (or ‘true’), anintra-prediction mode may be determined as a planar mode.

A CIIP mode means a mode where a prediction block of a current block isgenerated by a weighted sum of an intra prediction block for a currentblock and an inter prediction block for a current block. When a CIIPmode indicator determines that a CIIP mode is used, both intraprediction and inter prediction may be performed for a current block.Inter prediction of a current block may be performed by using a mergecandidate list that is used for general inter prediction mode. In otherwords, a merge candidate list may be constructed for inter prediction ofCIIP. Based on a signaled merge index, a merge candidate may be selectedfrom a merge candidate list. The motion information of the selectedmerge candidate may be used as motion information for inter predictionof a current block. In addition, without separate signaling ofinformation on an intra-prediction mode for intra prediction of acurrent block, intra prediction may be performed based on apredetermined mode. The predetermined mode may be signaled at a higherlevel of block (sequence, picture, slice and tile) or may be predefinedin an image encoder and decoder. For example, a planar mode may be fixedas the predetermined mode. When a current block is encoded/decoded as aCIIP mode, a prediction block of the current block may be obtained by aweighted sum of the inter prediction block and the intra predictionblock.

When an intra-prediction mode of a current block is derived by using anMPM list, intra-prediction mode information may be signaled.Intra-prediction mode information may be at least one amongfirst_mpm_flag, intra_luma_mpm_flag, intra_luma_mpm_idx and/orintra_luma_mpm_remainder.

intra_luma_mpm_flag may indicate whether or not there is the same modeas an intra-prediction mode of a current block in an MPM list. Here,when intra_luma_mpm_flag is ‘1’, intra_luma_mpm_idx indicating whichmode among candidate modes in an MPM list is the same mode as anintra-prediction mode of a current block may be signaled. Alternatively,on the contrary, when intra_luma_mpm_flag is ‘0’,intra_luma_mpm_remainder may be signaled which indicates anintra-prediction mode of a current block among modes except an MPM mode.

It may be determined that at least one among the above intra-predictionmodes is not signaled based on at least one among a reference sampleline indicator (for example, intra_luma_ref_idx), a block partitionindicator (for example, intra_subblock_flag,intra_subpartitions_mode_flag, etc.), a block partition directionindicator (for example, intra_subblock_type_flag,intra_subpartitions_split_flag, etc.) and an indicator showing whetheror not inter prediction and intra prediction are combined (for example,inter_intra_flag, ciip_flag).

For example, when a reference sample line indicator for a current block(for example, intra_luma_ref_idx) is not ‘0’, intra_luma_mpm_flag orintra_luma_mpm_remainder may not be signaled. Herein, onlyintra_luma_mpm_idx may be signaled and thus an intra-prediction mode ofa current mode may be derived. In other words, when a reference sampleline indicator for a current block is not 0, it may be inferred that anintra-prediction mode of a current block is derived as one of MPM modes.In other words, intra_luma_mpm_flag may be inferred to be 1.Accordingly, in this case, intra_luma_mpm_flag andintra_luma_mpm_remainder may not be signaled and only intra_luma_mpm_idxmay be signaled. intra_luma_mpm_idx may be an index indicating one amongN MPM modes included in an MPM list. Here, N may be 4, 5, or 6. Inaddition, when entropy encoding/decoding is performed by truncated ricebinarization, each index may be encoded/decoded into 0, 10, 110 and 111.

In addition, when a sub-block partition prediction for a current blockis performed, intra_luma_mpm_flag or intra_luma_mpm_remainder may not besignaled. Herein, only intra_luma_mpm_idx may be signaled and thus anintra-prediction mode of a current mode may be derived.Intra_luma_mpm_idx may be an index indicating one among five MPM modes.In addition, when entropy encoding/decoding is performed by truncatedrice binarization, each index may be encoded/decoded into 0, 10, 110,1110 and 1111.

In addition, when the combined inter and intra prediction is performedfor a current block, intra_luma_mpm_flag, intra_luma_mpm_idx orintra_luma_mpm_remainder may not be signaled, and a Planar mode may bederived as an intra-prediction mode of the current block.

When image encoding/decoding is performed through intra prediction, thestep of constructing a reference sample may be performed. Herein, thestep of constructing a reference sample may include at least one or moresteps among selecting a reference sample, padding a reference sample andfiltering a reference sample.

Based on a derived intra-prediction mode, a reference sample for intraprediction may be constructed. Hereinafter, a current block may mean aprediction block or a sub-block that has a smaller size and/or shapethan a prediction block. A reference sample may be constructed by usingone or more reconstructed samples adjacent to a current block or acombination thereof. Here, filtering may be performed for a constructedreference sample.

The number and/or position of reconstructed sample lines, which are usedto construct a reference sample, may be different according to theposition of a current block within a coding tree block. Here, eachreconstructed sample in a multiplicity of reconstructed sample lines maybe used as a reference sample as it is. Alternatively, a referencesample may also be generated by performing predetermined filtering for areconstructed sample and using a filtered reconstructed sample.Reconstructed samples, to which a filter is applied, may belong to thesame reconstructed sample line or different reconstructed sample lines.

The constructed reference sample may be expressed as ref[m, n], and aneighboring reconstructed sample with or without filtering appliedthereto may be expressed as rec[m, n]. Here, m or n may be apredetermined integer indicating the position of a sample. In addition,when the position of a top left sample within a current block is (0, 0),the position of a reference sample adjacent to the top left of a currentblock may be set as (−1, −1).

In order to construct a reference sample, the availability of aneighboring reconstructed sample may be judged. Here, when theneighboring reconstructed sample is located outside at least one or moreregions among picture, slice, tile and CTU, it may be judged to beunavailable. In addition, when constrained intra prediction is performedfor a current block and the neighboring reconstructed sample is locatedin a block that is encoded/decoded by inter prediction, the sample maybe judged to be unavailable.

When a neighboring reconstructed sample is judged to be unavailable,another neighboring reconstructed sample that is available may be usedand replace the unavailable sample.

For example, starting from the bottom left sample position, an adjacentavailable sample may be used and replace an unavailable sample.

In addition, an unavailable sample may be replaced by using acombination of available samples. For example, an unavailable sample maybe replaced by using an average value of available samples located atboth ends of the unavailable sample.

In addition, unavailable samples may be replaced by using information onavailable reference samples. Here, an unavailable sample may be replacedby using not the value of an adjacent available reference sample but anarbitrary value. The arbitrary value may be either an average value ofavailable sample values or a value considering a gradient of availablesample values. Alternatively, both an average value and a gradient maybe used. Here, a gradient may be determined based on a difference valueof adjacent available samples. Alternatively, apart from the averagevalue, a maximum value, a minimum value, a median value or a weightedsum, to which an arbitrary weight is applied, may be used. Here, anarbitrary weight may be determined based on a distance between anavailable sample and an unavailable sample.

The above methods may be applied to all the top and left referencesamples or only to an arbitrary direction. In addition, when a referencesample line of a current block is constructed by using a multiplicity ofreference sample lines, the methods may also be applied.

Whether or not filtering is to be performed for one or more constructedreference samples may be determined based on at least one among anintra-prediction mode of a current block or the size/shape of a block.When filtering is performed, a filter type may become differentaccording to at least one among an intra-prediction mode of a currentblock and the size and shape of a block.

When a sub-block partition prediction for a current block is performed,a reference sample for each sub-block may be constructed. Here, thehorizontal or vertical length of a reference sample may be twice thehorizontal or vertical length of each sub-block.

For example, when the size of a current block is M×N and the currentblock is horizontally partitioned into four equal parts so that eachsub-block has a size of M×(N/4), a reference sample for sub-block mayhave a horizontal length of 2*M and a vertical length of 2+(N/4). Inother words, based on the size of a block where prediction and transformare performed, a reference sample with 2*horizontal length and2*vertical length may be constructed.

When image encoding/decoding through intra prediction is performed, thestep of performing intra prediction may be performed.

Herein, in the step of performing intra prediction, filtering for aprediction sample may be additionally performed. Whether or not toperform the additional filtering may be determined based on at least oneor more among an intra-prediction mode, an inter-prediction mode, thehorizontal and vertical sizes of a block, the shape of a block, and theposition of a sample. Here, at least one among a filter coefficient, afilter tap and a filter shape may be different.

Intra prediction for a current block may be performed based on a derivedintra-prediction mode and a reference sample.

When a derived intra-prediction mode is a DC mode, an average value ofthe one or more constructed reference samples may be used. Herein,filtering may be performed for one or more prediction samples located onthe boundary of a current block. Prediction through DC mode may bedifferently performed based on at least one of the size and shape of acurrent block. For example, the range of a reference sample used in a DCmode may be specified based on the size and/or shape of a current blockand a reference sample line indicator.

FIG. 14 is a view for explaining an embodiment of DC predictionaccording to the size and/or shape of a current block in accordance withan embodiment of the present invention.

Referring to FIG. 14A, when a current block is square, DC prediction maybe performed by using an average value of the top and left samples ofthe current block.

In addition, when a current block is not square, a neighboring sampleadjacent to the left or top of the current block may be selectivelyused. For example, as illustrated in FIG. 14B, when a current block isrectangular, DC prediction may be performed by using an average value ofreference samples adjacent to the longer between the horizontal lengthand the vertical length of the current block.

In addition, when the size of a current block is a predetermined size orwithin a predetermined range, a predetermined sample of a referencesample line indicated by a reference sample line indicator may beselected among the top or left reference samples of the current block,and DC prediction may be performed by using an average value of samplesthus selected.

The predetermined size may mean a fixed size of N×M that is predefinedin an encoder/decoder. Here, N and M are integers above 0 and may be thesame or different.

The predetermined range may mean a threshold value for selecting areference sample of a current block. The threshold value may beimplemented as at least one of a maximum value and a minimum value.Herein, a minimum value and/or a maximum value may be a fixed value thatis predefined in an encoder/decoder or a variable value that is encodedin an encoder and is signaled.

As described above, an average value of one or more reference samplesmay be used for DC prediction. For calculation of an average value,division using the number of reference samples may be performed. Here,if the number of reference samples is 2^(n) (where n is a positiveinteger), the division may be replaced by a binary shift operation.

In the case of a non-square block, if both the top and left referencesamples are used, the number of reference samples may not be 2^(n), inwhich case a shift operation cannot be used instead of the divisionoperation. Accordingly, as in the above embodiment, the divisionoperation may be replaced by the shift operation by using only 2^(n) topor left reference samples.

When an intra-prediction mode is a Planar mode, a weighted sumconsidering a distance from at least one or more constructed referencesamples may be used according to the position of a target sample forintra prediction of a current block.

When an intra-prediction mode is a directional mode, one or morereference samples existing on and around a predetermined angular line atthe position of a target sample of intra prediction may be used.

When the directional prediction is performed, an intra-prediction modemay be changed to a predetermined mode on the basis of the shape of acurrent block. In other words, if the intra-prediction mode is adirectional mode and the horizontal size and the vertical size of ablock are different from each other, the intra-prediction mode may bechanged to a predetermined mode on the basis of the ratio between thehorizontal size and the vertical size. A ratio between the width andheight of a block (whRaito) may be determined by whRatio=Abs (Log2(nW/nH)). Here, nW and nH may be the horizontal and vertical lengths ofa block respectively, and Abs(x) may represent an absolute value of x.

For example, when the horizontal size of a current block is larger thanthe vertical size thereof, a predetermined directional mode that ispredicted from bottom left may be changed to a directional mode that ispredicted from top right. In other words, if all the followingconditions are satisfied, a predetermined offset may be applied to anintra-prediction mode and thus the intra-prediction mode may be changedby predModeIntra=predModeIntra+65. Here, predModeIntra may mean anintra-prediction mode.

(1) The horizontal size of a block is larger than the vertical sizethereof.

(2) predModeIntra is equal to or greater than 2.

(3) predModeIntra is smaller than a predetermined mode. Here, if whRatiois 1, a predetermined mode may be 8, and if whRatio is greater than 1, apredetermined mode may be (8+2*whRatio). Alternatively, a predeterminedmode may be fixed to (8+2*whRatio) irrespective of the size of whRatio.

In addition, when the vertical size of a current block is larger thanthe horizontal size thereof, a predetermined directional mode that ispredicted from top right may be changed to a mode that is predicted frombottom left. In other words, if all the following conditions aresatisfied, a predetermined offset may be applied to an intra-predictionmode and thus the intra-prediction mode may be changed bypredModeIntra=predModeIntra−67.

(1) The vertical size of a block is larger than the horizontal sizethereof.

(2) predModeIntra is equal to or less than 66.

(3) predModeIntra is larger than a predetermined mode. Here, if whRatiois 1, a predetermined mode may be 60, and if whRatio is greater than 1,a predetermined mode may be (60−2*whRatio). Alternatively, apredetermined mode may be fixed to (60−2*whRatio) irrespective of thesize of whRatio.

When prediction is performed by partitioning a current block intosub-blocks, each sub-block may be predicted by commonly using oneintra-prediction mode that is derived based on the current block. Inthis case, an intra-prediction mode may be changed to a predeterminedmode on the basis of the shape of a sub-block (for example, thehorizontal and vertical sizes of a block). In other words, anintra-prediction mode of the current block may be derived by using aneighboring intra-prediction mode based on the size of the currentblock. Based on the horizontal and vertical sizes of a sub-blockobtained by partitioning the current block, the derived intra-predictionmode of the current block may be changed to a predetermined mode.

For example, the size of a current block may be 32×32, anintra-prediction mode (predModeIntra) may be 4, and sub-blocks may beconstructed by partitioning the current block into four equal parts inthe horizontal direction. Here, based on the size 32×8 of eachsub-block, the intra-prediction mode (predModeIntra) 4 may be changed byapplying the above method. In other words, since whRatio is 2, thehorizontal size of a sub-block is larger than the vertical size thereof,predModeIntra is greater than 2, and predModeIntra is less than (8+2*2),the intra-prediction mode may be changed to 69 (=4+65).

For another example, the size of a current block may be 32×8, anintra-prediction mode (predModeIntra) may be 4, and sub-blocks may beconstructed by partitioning the current block into four equal parts inthe vertical direction. Here, based on the size 8×8 of each sub-block,the intra-prediction mode (predModeIntra) 4 may be changed by applyingthe above method. However, in this case, since the horizontal andvertical sizes of a sub-block become the same by applying the method, anintra-prediction mode may not be changed.

In the case of a positional information-based intra-prediction mode, areconstructed sample block, which is generated based on encoded/decodedor derived positional information, may be used as an intra-predictionblock of a current block. Alternatively, a decoder may search and derivea reconstructed sample block that is to be used as an intra-predictionblock of a current block.

Whether or not a positional information-based intra-prediction mode isapplied to a current block may be explicitly signaled as a flag for acurrent block or may be implicitly derived. In this specification, aflag indicating whether or not a positional information-basedintra-prediction mode is applied to a current block may be called IBC(Intra Block Copy) flag.

For example, when a tile group, to which a current block belongs, is Itile group that does not refer to other pictures and the current blockis not a skip block, the IBC flag may be signaled.

In addition, when a tile group, to which a current block belongs, is Itile group and the current block is not a general intra-prediction mode,the IBC flag may be signaled.

Availability information indicating whether or not a positionalinformation-based intra-prediction mode is available at an upper level(for example, sequence level, etc.) of a current block may be signaled.Here, the IBC flag may be explicitly signaled only when the availabilityinformation indicates availability.

When the IBC flag is not signaled, the IBC flag value may be implicitlyderived based on the attribute of a tile group to which a current blockbelongs.

For example, when a current block is I tile group, the IBC flag valuemay be derived as a value of available information.

In addition, when a current block is P or B tile group, the IBC flagvalue may be derived as 0.

When the IBC flag value is 1, it may mean that a positionalinformation-based intra-prediction mode is applied to a current block.When the IBC flag value is 0, it may mean that a positionalinformation-based intra-prediction mode is not applied to a currentblock.

Positional information may be restored to perform positionalinformation-based intra prediction. Both a current block and areconstructed sample block are included in a current picture, andpositional information may be information on a difference of positionbetween the current block and the reconstructed sample block. Here,restoring positional information may be similar to a way ofreconstructing a motion vector of inter prediction.

For example, similar to a merge mode in inter prediction, positionalinformation may be restored from the positional information of aneighboring block. To this end, information indicating a merge mode (forexample, MergeFlag=1) may be signaled, and a merge candidate listincluding N (N is a positive integer) candidates may be constructed.

For example, N may be 5. In other words, a merge candidate listincluding five merge candidates may be constructed. Here, five mergecandidates may be the same as five spatial merge candidates of interprediction, and the priority order of adding them to a merge candidatelist may also be the same. All the five spatial merge candidates may beincluded in a merge candidate list. In addition, when the number ofcandidates included in a merge candidate list is less than 5, anadditional candidate may be included. Here, the positional informationof an additional candidate may an average or a weighted average of thepositional information of two candidates that are selected fromcandidates, which are already included in a merge candidate list,according to a predetermined rule. The two selected candidates may bethe first and second candidates of a merge candidate list.

Alternatively, a candidate that is selected from a list of candidates,which are used for intra prediction based on the positional informationof a previous block, according to a predetermined rule may be includedas additional candidate of a current block. As signaled indexinformation is applied to a merge candidate list thus constructed, thepositional information of a current block may be restored.

For example, positional information may be restored as a sum ofpredicted positional information of the positional information andresidual positional information. To this end, information indicatingthat it is not a merge mode may be signaled (for example, MergeFlag=0),and the candidate of a predictor may be the left block and top block ofa current block.

Herein, a list may be constructed by using the positional information ofa left block and the positional information of a top block, and thepredicted positional information of a current block may be derived byapplying a signaled index. When two or less pieces of predictedpositional information are included in a list, the rounded-offinformation of predicted positional information that is already includedand/or zero positional information may be added to the list.

When luma information and chroma information are partitioned into thesame tree structure, the positional information for a chroma block maybe derived based on the positional information for a luma block. On theother hand, when luma information and chroma information are partitionedinto different tree structures, a chroma block may be partitioned intosub-blocks, each of which has a predetermined size (for example, 4×4),and the positional information of each sub-block may be derived based onthe positional information of a luma block at the correspondingposition.

Derived positional information may be updated into a predetermined listto be used for deriving the positional information of a next block.Here, the predetermined list may mean the above-described ‘a list ofcandidates, which are used for intra prediction based on the positionalinformation of a previous block’. Here, it may be confirmed whether ornot positional information to be added is already included in the list.When the same positional information is included in a list, thecorresponding positional information is removed from the list, and thepositions of pieces of positional information succeeding the removedpositional information are moved, thereby filling the place of theremoved positional information. Then, the positional information to beadded may be added to the final position of the list. When there is nosame positional information in a list, the positional information to beadded may be added at the end of the list.

When positional information for a current block is derived, it may beused to generate a prediction block of the current block. A picture towhich positional information is to be applied may be a restored currentpicture. For example, when inter prediction is performed by using arestored current picture as a reference picture and using positionalinformation as a motion vector, a prediction block of a current blockmay be generated from the restored current picture.

Intra prediction for a chroma signal may be performed by using arestored luma signal of a current block. In addition, when one restoredchroma signal Cb of a current block or the residual signal of Cb isused, intra prediction for another chroma signal Cr may be performed.

Intra prediction may be performed by combining one or more predictionmethods described above. For example, an intra-prediction block for acurrent block may be constructed through a weighted sum of a block,which is predicted by using a predetermined non-directionalintra-prediction mode, and a block that is predicted by using apredetermined directional intra-prediction mode. Here, a weight may bedifferently applied according to at least one among an intra-predictionmode of a current block, the size of a block and the position of asample.

Alternatively, in the case of a chroma block, an intra-prediction blockfor a chroma block may be constructed through a weighted sum of a block,which is predicted by using a predetermined intra-prediction mode, and ablock that is predicted by using a restored signal of a luma block.Here, a predetermined intra-prediction mode may be one of the modes usedfor deriving an intra-prediction mode of a chroma block. In the case ofa chroma block, whether or not a final prediction block is constructedby using a weighted sum of two prediction blocks as described above maybe signaled through encoded information.

In the case of a directional mode, based on a directional predictionmode, the reference sample constructed above may be constructed again.For example, when the directional prediction mode is a mode using allthe reference samples existing on the left or top, a one-dimensionalarrangement may be constructed for the left or top reference samples.Alternatively, a top reference sample may be constructed by moving aleft reference sample. A top reference sample may be constructed byusing a weighted sum of one or more left reference samples.

Alternatively, different directional intra predictions may be performedin units of a predetermined sample group of a current block. Here, apredetermined sample group unit may be a block, a sub-block, a line or asingle sample.

FIG. 15 is a view for explaining a process of performing intraprediction between color components to an embodiment of the presentinvention.

According to an embodiment of the present invention, intra predictionbetween color components may be performed.

Referring to FIG. 15, a process of performing intra prediction betweencolor components may include reconstructing a color component block(S1510), deriving a prediction parameter (S1520) and/or performingprediction between color components (S1530). However, the process maynot be limited to those steps.

A color component may mean at least one among a luma signal, a chromasignal, Red, Green, Blue, Y, Cb and Cr. Prediction for a first colorcomponent may be performed by using at least one or more among a secondcolor component, a third color component and a fourth color component.Herein, a signal of a color component used for prediction may be atleast one among an original signal, a restored signal, a residual signaland a prediction signal.

When intra prediction is performed for a second color component targetblock, at least one sample among the sample of a corresponding block ofa first color component, which corresponds to the second color componenttarget block, and/or the sample of a neighboring block of thecorresponding block may be used.

For example, when intra prediction is performed for a chroma componentblock Cb or Cr, a reconstructed luma component block Y corresponding tothe chroma component block may be used.

Alternatively, when intra prediction is performed for a Cr componentblock, a Cb component block may be used.

Alternatively, when intra prediction is performed for a fourth componentblock, a combination of at least one or more among a first colorcomponent block, a second color component block and/or a third colorcomponent block, which correspond to the fourth component block, may beused.

Whether or not intra prediction between color components is possible maybe determined based on a coding parameter of a current block. The codingparameter of a current block may include at least one among a slice typecomprising the current block, whether or not the current block isdual-tree partitioned block, and the size and shape of the currentblock.

For example, when the size of a target block is a CTU size, exceeds apredetermined size or is within a predetermined size range, it may bedetermined that intra prediction between color components can beperformed for the target block.

Specifically, when a current block is included in I slice and the lumacomponent and the chroma component of the current block are notdual-tree partitioned block, it may be determined that intra predictionbetween color components can be performed for the current block.Dual-tree partitioning may mean that the luma component and the chromacomponent of a current are partitioned according to separate treestructures.

In addition, when the slice type of a target block is not I slice, itmay be determined that intra prediction between color components can beperformed for the target block. Accordingly, for example, when the slicetype of a target block is P slice or B slice, it may be determined thatintra prediction between color components can be performed for thetarget block.

In addition, when the shape of a target block is a predetermined shape,it may be determined that intra prediction between color components canbe performed for the target block. Here, if a target block isrectangular, intra prediction between color components may not beperformed and the above-described embodiment may be implemented in theopposite way.

When it is determined that intra prediction between color components canbe performed for a current block, intra prediction between colorcomponents may be performed for the current block. Alternatively, whenit is determined that intra prediction between color components can beperformed for a current block, information on whether or not intraprediction between color components is applied to the current block maybe separately signaled. In this case, based on information on whether ornot intra prediction between color components is applicable to a currentblock, whether or not to apply intra prediction between color componentsto the current block may be ultimately determined.

Whether or not to perform intra prediction between color components mayalso be determined based on at least one or more coding parameters amonga corresponding block to a prediction target block and a neighboringblock of the corresponding block.

For example, when a corresponding block is inter-predicted in the CIP(Constrained Intra Prediction) environment, intra prediction betweencolor components may not be performed.

In addition, when an intra-prediction mode of a corresponding block is apredetermined mode, intra prediction between color components may beperformed.

In addition, whether or not to perform intra prediction between colorcomponents may be determined based on at least one or more pieces ofinformation among pieces of CBF (Coding Block Flag) information of acorresponding block and a neighboring block. Here, the CBF informationmay be information showing whether or not there is a residual signal.

The coding parameter is not limited to a prediction mode of a block, andvarious parameters available for encoding/decoding may be used.

Referring to FIG. 15, in order to perform intra prediction between colorcomponents, the step of reconstructing a color component block may beperformed (S1510).

When a second color component block is predicted by using a first colorcomponent block, the first color component block may be reconstructed.

For example, when the color space of an image is YcbCr and the ratioamong color components is one among 4:4:4, 4:2:2 and 4:2:0, the size ofa block between color components may be different. Accordingly, when asecond color component block is predicted by using a first colorcomponent block with a different size, the first color component blockmay be reconstructed to make the two blocks equal in size. In this case,the reconstructed block may include at least one or more among a sampleof a first color component corresponding block and a sample of aneighboring block.

In the above-described step of constructing a reference sample, anindicator (for example, intra_luma_ref_idx) corresponding to apredetermined line among a multiplicity of reference sample lines may besignaled. Here, in the reconstructing step, reconstruction may beperformed by using a predetermined line corresponding to the signaledindicator.

For example, when a reference sample line indicator (intra_luma_ref_idx)is ‘3’, reconstruction may be performed by using a fourth referencesample line adjacent to a first color component corresponding block.Here, if reconstruction is performed by using two or more referencesample lines, a third reference sample line may be additionally used.

In addition, when a reference sample line indicator (intra_luma_ref_idx)is ‘1’, reconstruction may be performed by using a second referencesample line adjacent to a first color component corresponding block.

The method of using the indicator in the reconstruction process may beused when a first color component block and a second color componentblock have the same partition structure.

For example, when both a first color component block and a second colorcomponent block in one CTU have the same single tree partitionstructure, the indicator-based reconstruction process may be performed.

In the reconstruction process, when at least one of the boundary of asecond color component target block and the boundary of a first colorcomponent block corresponding thereto is the boundary of a predeterminedregion, a reference sample used for reconstruction may be differentlyselected. Here, the top and left reference sample lines may be differentin number. In addition, the predetermined region may be at least oneamong picture, slice, tile, CTU and CU.

For example, when the upper boundary of a first color componentcorresponding block is the boundary of the predetermined region,reconstruction may be performed by using not a top reference sample butonly a left reference sample.

In addition, when the left boundary of a first color componentcorresponding block is the boundary of the predetermined region,reconstruction may be performed by using not a left reference sample butonly a top reference sample.

In addition, N top reference sample lines and M left reference samplelines may be used. Here, N may be less than M. For example, when anupper boundary is the boundary of the predetermined region, N may be 1.Alternatively, when a left boundary is the boundary of the predeterminedregion, M may be 1.

In addition, irrespective of whether or not it is the boundary of thepredetermined region, reconstruction may be performed by using N topreference sample lines and/or M left reference sample lines of the firstcolor component corresponding block.

According to an embodiment of the present invention, in order to performintra prediction between color components, the step of deriving aprediction parameter may be performed (S1520).

A prediction parameter may be derived by using at least one or moreamong a reference sample of a first color component corresponding block,which is reconstructed in the step S1510, and a reference sample of asecond color component prediction target block. Hereinafter, in thisspecification, a first color component and a first color component blockmay mean a reconstructed first color component and a reconstructed firstcolor component block respectively.

For example, a prediction parameter may be derived by adaptively using areference sample of the reconstructed first color component based on anintra-prediction mode of a first color component corresponding block.Herein, a reference sample of a second color component may also beadaptively used based on the intra-prediction mode of the first colorcomponent corresponding block.

According to an embodiment of the present invention, in order to performintra prediction between color components, the step of performingprediction between color components may be performed (S1530).

When a prediction parameter is derived in the step S1520, intraprediction between color components may be performed by using at leastone of the derived prediction parameters.

The method of prediction between color components may also be applied toan inter-prediction mode. For example, when inter prediction isperformed for a current block, inter prediction may be performed for afirst color component, and prediction between color components may beperformed for a second color component. For example, the first colorcomponent may be a luma component, and the second color component may bea chroma component.

In addition, the prediction between color components may be adaptivelyperformed according to a coding parameter of a first color component.

For example, whether or not to perform the prediction between colorcomponents may be determined according to the CBF information of thefirst color component. Here, the CBF information may be informationshowing whether or not there is a residual signal.

In other words, when the CBF of the first color component is ‘a’,prediction between color components may be performed for a second colorcomponent. On the other hand, when the CBF of the first color componentis ‘0’, prediction between color components may not be performed for asecond color component, but inter prediction may be performed.

In addition, a flag indicating whether or not prediction between colorcomponents is performed may be separately signaled. Here, whether or notprediction between color components is performed may be determined basedon a CCLM mode indicator (cclm_mode_flag). For example, when a CCLM modeindicator (cclm_mode_flag) is ‘1’ (or ‘true’), it may be determined thatprediction between color components is performed for a chroma block. Ifthere is no CCLM mode indicator (cclm_mode_flag) value, it may bedetermined that no prediction between color components is performed.

When prediction between color components is performed, if an encodingmode of a first color component is an inter-prediction mode, predictionbetween color components may be performed for a second color component.

For example, when inter prediction is performed for a current block,inter prediction may be performed for a first color component, andprediction between color components may be performed for a second colorcomponent. Here, the first color component may be a luma component, andthe second color component may be a chroma component.

Prediction between color components may be performed by using areconstructed sample or a prediction sample of the luma component. Forexample, after inter prediction for the luma component is performed,prediction for a chroma component may be performed by applying aparameter of prediction between color components for a predictionsample. Here, the prediction sample may mean a sample for which at leastone among motion compensation, motion correction, OBMC (Overlapped BlockMotion Compensation) and BIO (BI-directional Optical flow) is performed.

The prediction between color components may be adaptively performedaccording to a coding parameter of a first color component. For example,whether or not to perform the prediction between color components may bedetermined according to the CBF information of the first colorcomponent. The CBF information may be information showing whether or notthere is a residual signal.

In other words, when the CBF of the first color component is ‘1’,prediction between color components may be performed for a second colorcomponent. On the other hand, when the CBF of the first color componentis ‘0’, prediction between color components may not be performed for asecond color component, but inter prediction may be performed.

In addition, a flag indicating whether or not the prediction betweencolor components is performed may be signaled. For example, whether ornot prediction between color components is performed may be signaled inunits of CU or PU. Here, whether or not prediction between colorcomponents is performed may be determined based on a CCLM mode indicator(cclm_mode_flag).

When the coding parameter of the first color component satisfies apredetermined condition, a flag indicating whether or not predictionbetween color components is performed may be signaled.

For example, when the CBF of a first color component is 1, whether ornot color component prediction is performed may be determined bysignaling a flag indicating whether or not prediction between colorcomponents is performed.

When prediction between color components is performed for the secondcolor component, an inter-picture motion prediction or compensationvalue for the second color component may be used.

For example, inter-picture motion prediction or compensation for asecond color component may be performed by using inter predictioninformation for a first color component, and prediction may be performedthrough a weighted sum of a value of prediction between color componentsand an inter-picture motion compensation value for a second colorcomponent.

Alternatively, when an inter-prediction mode of a current block is amerge mode, prediction for a second color component of the current blockmay be performed through a weighted sum of a value, which is predictedby using motion information corresponding to a merge index, and a valuethat is predicted by performing prediction between color components.

Here, a first color component block used for performing predictionbetween color components may be at least one of a predicted value frominter prediction (using a merge mode, for example) and a reconstructedvalue.

In addition, a weight for the weighted sum may be 1:1.

The above embodiments may be performed in the same method in an encoderand a decoder.

At least one or a combination of the above embodiments may be used toencode/decode a video.

A sequence of applying to above embodiment may be different between anencoder and a decoder, or the sequence applying to above embodiment maybe the same in the encoder and the decoder.

The above embodiment may be performed on each luma signal and chromasignal, or the above embodiment may be identically performed on luma andchroma signals.

A block form to which the above embodiments of the present invention areapplied may have a square form or a non-square form.

The above embodiment of the present invention may be applied dependingon a size of at least one of a coding block, a prediction block, atransform block, a block, a current block, a coding unit, a predictionunit, a transform unit, a unit, and a current unit. Herein, the size maybe defined as a minimum size or maximum size or both so that the aboveembodiments are applied, or may be defined as a fixed size to which theabove embodiment is applied. In addition, in the above embodiments, afirst embodiment may be applied to a first size, and a second embodimentmay be applied to a second size. In other words, the above embodimentsmay be applied in combination depending on a size. In addition, theabove embodiments may be applied when a size is equal to or greater thata minimum size and equal to or smaller than a maximum size. In otherwords, the above embodiments may be applied when a block size isincluded within a certain range.

For example, the above embodiments may be applied when a size of currentblock is 8×8 or greater. For example, the above embodiments may beapplied when a size of current block is 4×4 only. For example, the aboveembodiments may be applied when a size of current block is 16×16 orsmaller. For example, the above embodiments may be applied when a sizeof current block is equal to or greater than 16×16 and equal to orsmaller than 64×64.

The above embodiments of the present invention may be applied dependingon a temporal layer. In order to identify a temporal layer to which theabove embodiments may be applied, a corresponding identifier may besignaled, and the above embodiments may be applied to a specifiedtemporal layer identified by the corresponding identifier. Herein, theidentifier may be defined as the lowest layer or the highest layer orboth to which the above embodiment may be applied, or may be defined toindicate a specific layer to which the embodiment is applied. Inaddition, a fixed temporal layer to which the embodiment is applied maybe defined.

For example, the above embodiments may be applied when a temporal layerof a current image is the lowest layer. For example, the aboveembodiments may be applied when a temporal layer identifier of a currentimage is 1. For example, the above embodiments may be applied when atemporal layer of a current image is the highest layer.

A slice type or a tile group type to which the above embodiments of thepresent invention are applied may be defined, and the above embodimentsmay be applied depending on the corresponding slice type or tile grouptype.

In the above-described embodiments, the methods are described based onthe flowcharts with a series of steps or units, but the presentinvention is not limited to the order of the steps, and rather, somesteps may be performed simultaneously or in different order with othersteps. In addition, it should be appreciated by one of ordinary skill inthe art that the steps in the flowcharts do not exclude each other andthat other steps may be added to the flowcharts or some of the steps maybe deleted from the flowcharts without influencing the scope of thepresent invention.

The embodiments include various aspects of examples. All possiblecombinations for various aspects may not be described, but those skilledin the art will be able to recognize different combinations.Accordingly, the present invention may include all replacements,modifications, and changes within the scope of the claims.

The embodiments of the present invention may be implemented in a form ofprogram instructions, which are executable by various computercomponents, and recorded in a computer-readable recording medium. Thecomputer-readable recording medium may include stand-alone or acombination of program instructions, data files, data structures, etc.The program instructions recorded in the computer-readable recordingmedium may be specially designed and constructed for the presentinvention, or well-known to a person of ordinary skilled in computersoftware technology field. Examples of the computer-readable recordingmedium include magnetic recording media such as hard disks, floppydisks, and magnetic tapes; optical data storage media such as CD-ROMs orDVD-ROMs; magneto-optimum media such as floptical disks; and hardwaredevices, such as read-only memory (ROM), random-access memory (RAM),flash memory, etc., which are particularly structured to store andimplement the program instruction. Examples of the program instructionsinclude not only a mechanical language code formatted by a compiler butalso a high level language code that may be implemented by a computerusing an interpreter. The hardware devices may be configured to beoperated by one or more software modules or vice versa to conduct theprocesses according to the present invention.

Although the present invention has been described in terms of specificitems such as detailed elements as well as the limited embodiments andthe drawings, they are only provided to help more general understandingof the invention, and the present invention is not limited to the aboveembodiments. It will be appreciated by those skilled in the art to whichthe present invention pertains that various modifications and changesmay be made from the above description.

Therefore, the spirit of the present invention shall not be limited tothe above-described embodiments, and the entire scope of the appendedclaims and their equivalents will fall within the scope and spirit ofthe invention.

INDUSTRIAL APPLICABILITY

The present invention may be used to encode or decode an image.

1-19. (canceled)
 20. A video decoding method, comprising: deriving aprediction mode of a current block based on a bitstream; and generatinga prediction block of the current blocking by performing a predictionbased on the prediction mode of the current block.
 21. The videodecoding method of claim 20, wherein: whether the current block ispartitioned or not is determined using block partition information, adirection of partitioning for the current block is determined usingpartition direction information, whether the block partition informationis signaled via the bitstream is determined according to whether ahorizontal size and a vertical size of the current block are smallerthan or equal to a predetermined size.
 22. The video decoding method ofclaim 21, wherein: an intra prediction mode of the current block isapplied to a plurality of sub-blocks commonly in a case that the currentblock is partitioned.
 23. The video decoding method of claim 20,wherein: the prediction is an intra prediction. the intra prediction isperformed using a Most Probable Mode (MPM) list, and the intraprediction is performed using one of 5 candidates of the MPM list. 24.The video decoding method of claim 23, wherein: the intra predictiondoesn't use a Planar mode in a case that a reference sample line indexfor the current block is not
 0. 25. The video decoding method of claim23, wherein: an intra prediction mode of the intra prediction isdetermined based on a ratio of a horizontal length of the current blockand a vertical length of the current block.
 26. The video decodingmethod of claim 23, wherein: an intra prediction mode of the intraprediction is determined, and the determined intra prediction mode ischanged in a case that a horizontal length of the current block and avertical length of the current block are different from each other. 27.The video decoding method of claim 23, wherein: the prediction mode isan intra prediction which uses a reference sample adjacent to thecurrent block, the intra prediction is performed using one of aplurality of candidates of a Most Probable Mode (MPM) list, and a Planarmode is not included in the plurality of the candidates.
 28. The videodecoding method of claim 20, wherein: the prediction is an intraprediction, the intra prediction is performed using information relatedwith the prediction, and a Planar mode is used for the intra predictionand a Most Probable Mode (MPM) list is not derived in a case that aspecific prediction method is used according to the information relatedwith the prediction.
 29. The video decoding method of claim 20, wherein:the prediction is a combination of an intra prediction and an Interprediction, and only a specific intra prediction mode is used for theintra prediction.
 30. The video decoding method of claim 29, wherein: aMost Probable Mode (MPM) list for the prediction is not derived in acased that the combination is used.
 31. The video decoding method ofclaim 20, wherein: the prediction is an intra prediction using a DCmode, a reference sample of the intra prediction is constructed using areference sample line selected from a plurality of reference samplelines.
 32. The video decoding method of claim 20, wherein: theprediction is position information-based prediction using areconstructed sample block comprised in a current picture comprising thecurrent block as a prediction block of the current block, thereconstructed sample block is determined based on location information,the location information is information related to a difference betweena location of the current block and a location of the reconstructedsample block, whether to apply the location information-based predictionis determined according to a size of the current block.
 33. The videodecoding method of claim 32, wherein: availability informationindicating whether the location information-based prediction isavailable at a higher level of the current block is signaled, and a flagindicating whether the location information-based prediction is used forthe current block is signaled in a case that the locationinformation-based prediction is available for the higher level of thecurrent block.
 34. The video decoding method of claim 20, wherein: thecurrent block is a chroma block, the prediction is inter-componentprediction using a signal of a luma block corresponding to the chromablock, and whether the inter-component prediction is performed isdetermined based on a size of the chroma block.
 35. The video decodingmethod of claim 20, wherein: the current block is a chroma block, theprediction is inter-component prediction using a signal of a luma blockcorresponding to the chroma block, whether the inter-componentprediction is performed is determined based on a coding parameter forthe current block, and the coding parameter comprises at least one of aslice type of the current block, information for a partitioning using atree for the current block and intra partitioning information for thecurrent block.
 36. The video decoding method of claim 35, wherein: aflag indicating whether the inter-component prediction is performed issignaled via the bitstream in a case that the coding parameter satisfiesa predetermined condition.
 37. The video decoding method of claim 36,wherein: the flag is signaled for a Coding Unit (CU).
 38. A videoencoding method, comprising: deriving a prediction mode of a currentblock; and generating a prediction block of the current blocking byperforming a prediction based on the prediction mode of the currentblock, wherein a bitstream indicating the prediction mode is generated.39. A non-transitory computer readable recording medium storing abitstream, the bitstream comprising: information for deriving aprediction mode for a current block; wherein the prediction mode of thecurrent block is derived using the information, and a prediction blockof the current block is generated by performing a prediction based onthe prediction mode of the current block.